[Question]
  [
Most people here are familiar with seven segment displays, which are also used in matchstick puzzles. Below are the digits `0` through `9` and letters `a` through `z`, except `k,m,t,v,w`, written in this format.
```
 _        _   _         _    _    _    _    _
| |   |   _|  _|  |_|  |_   |_     |  |_|  |_|
|_|   |  |_   _|    |   _|  |_|    |  |_|   _|
 _       _      _  _  _                        _   _      _               _
|_| |_  |   _| |_ |_ |   |_  |   | |   _   _  |_| |_|  _ |_      |_| |_|  _|
| | |_| |_ |_| |_ |  |_| | | | |_| |_ | | |_| |     | |   _| |_| | |   | |_
```
The challenge here is simple. Given an input string, output the number of matchsticks required to represent that string. If the string contains a character outside of the above representation, ignore it (count it as 0).
For example, for input `53`, a total of `10` matchsticks are required, `5` for the `5` and `5` for the `3`, so the output is `10`.
For input `hello` a total of `19` matchsticks are required, `h (4), e (5), l (3), l (3), o (4)`, so the output is `19`.
For clarity, here are the matchsticks required to build each character:
```
0 -> 6
1 -> 2
2 -> 5
3 -> 5
4 -> 4
5 -> 5
6 -> 6
7 -> 3
8 -> 7
9 -> 6
a -> 6
b -> 5
c -> 4
d -> 5
e -> 5
f -> 4
g -> 5
h -> 4
i -> 2
j -> 4
l -> 3
n -> 3
o -> 4
p -> 5
q -> 5
r -> 2
s -> 5
u -> 3
x -> 5
y -> 4
z -> 5
```
Now for the twist, and there are two of them.
* The first is that the input is considered case-*in*sensitive. That is, `A` and `a` should both count for `6` matchsticks, even though the visual representation looks like an uppercase `A`.
* Your score is your source code run through this algorithm, plus the length of your source code in bytes, lower is better. For example, if your source code was `abc123`, your score would be `6+5+4+2+5+5 = 27 + 6 = 33`. If your source code was `#&@()*`, your score would be `0 + 6 = 6`.
### Input/Output Examples
```
0    -> 6
53   -> 10
111  -> 6
112  -> 9
8888 -> 28
hello -> 19
PPCG  -> 19
Programming Puzzles & Code Golf -> 99
#&()mt!!~ -> 0
*DḌƤÆE%Ḅċ0 -> 16
```
## Rules
* If applicable, you can assume that the input/output will fit in your language's native Integer type.
* The input and output can be given by [any convenient method](http://meta.codegolf.stackexchange.com/q/2447/42963).
* Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
* [Standard loopholes](http://meta.codegolf.stackexchange.com/q/1061/42963) are forbidden.
  
[Answer]
# [Python 2](https://docs.python.org/2/), 97 bytes + 237 matches = 334
```
lambda w:sum(map(('1ir'*2+'7lnu'*3+'4cfhjoy'*4+'235bdegpqsxz'*5+'069a'*6+'8'*7).count,w.lower()))
```
[Try it online!](https://tio.run/##RZDNUsIwEMfvPMVSBrafDCnfnakXVK7cK4dCU6iTJtgPEQ6eHC/6GD4Edx3fgyfBhKLmkPz3t5vsP7vZFWvB3VMDHNMBypciSvjKg7KInZFiNUmor2naiYXpIgph6@VlqqfhRteRJBmaroVDxks0uxb2lvH6XuzQ7FnodvuLiK42D/nTHs2@hZ3BOERzYOEIzaHRXoqSF/a2zcSWZrphGCfZpWqntoB4DpnXYp8@hkxXxKjFIoOC5oWd0bxkBSQcggA7aMNgbgfY70pFOkoSQn4pIa6UYyVHckntjlSwpowJdeGcms0m0/8gE6ssTFM5CpiV@z2jObRgIj3AVLBYPXeua7R0Iy3q9WdJzm3N6@Ph/fvj8/WmeTy8fL0pa2Qwn3ubLOEFxLpyb/h@5d@uPoPOFdqXVK0q1O74bcJDBvlSZBQ8aEZWMwJfnlpTj6tx2Izyi7oQ648Ypx8 "Python 2 – Try It Online")
This works by generating a string where each buildable character appears the same amount of matchsticks required to build that character
[Answer]
## [Perl 5](https://www.perl.org/) with `-pF`, 95 bytes + 14, 109
```
eval~"Û£ÔÂ„…ÊÏÉÎÍÍÊÌÊËËÊÊÉÉÈÌÇÈÆÉžÉÊœË›ÊšÊ™Ë˜Ê—Ë–Í•Ë“Ì‘ÌËÊŽÊÍŒÊŠÌ‡Ê†ËÂÐÑÐ˜‚ÒÁ„Ô“œ‚™¿¹"}{
```
This is equivalent to:
```
$\+={z506122535445566738796a6b5c4d5e5f4g5h4i2j4l3n3o4p5q5r2s5u3x5y4=~/./g}->{+lc}for@F
```
but using the `~` operator we can use high-byte characters and avoid a lot of characters without really sacrificing bytes.
Still quite a way off Ton's score, even with assistance!
[Try it online!](https://tio.run/##NVBLSgNBEL1L9gFjTNJ9AXfeYDbzCwjBBI0yIEoniDoziRmTLESjxAjeQUGFLmaVW/RBHF/TJcWbV/V6ul5VD@LjXquq4jO/d1nzkijwEr8J3vOScNdLBFi0kPtAF5BADEQMq4fMAcNnSIbgfzqct50uY2buI0N3X3IPyX2kZF1w3eG67WaQLa6bzkc2mHecLrrunoiZeXbBcwveQXS4bvMedn/0itAnYrYzCOgREDbc@9i3st52fntm57Xe1ieAdyBrF@f/T0xP@o2WNDbqxah3ymhGKd3RFJHRBMgRGSJF3EK5wfea0vKbUv1MWbmg3KhPJK@UmasN5dsVErW08oKmRm1stqKJUQ800QXleoa/vyjTMCnnyNf20F5Xa5iN9YgKuqdiuzLqkeY0wmy0RI9yAQEeutBT/aM/sMZvfzA87B@dVPWBv1/VD@qnw674Aw "Perl 5 – Try It Online")
This solution contains unprintables so here's a reversible hex dump to verify the byte-count:
```
00000000: 6576 616c 7e22 dba3 d4c2 8485 cacf c9ce  eval~"..........
00000010: cdcd cacc cacb cbca cac9 c9c8 ccc7 c8c6  ................
00000020: c99e c99d ca9c cb9b ca9a ca99 cb98 ca97  ................
00000030: cb96 cd95 cb93 cc91 cc90 cb8f ca8e ca8d  ................
00000040: cd8c ca8a cc87 ca86 cbc2 81d0 d1d0 9882  ................
00000050: d2c1 84d4 939c 8299 908d bfb9 227d 7b    ............"}{
```
[Answer]
# JavaScript (ES6), 198 (102 bytes + 96 matchsticks)
*Saved 5 points thanks to @l4m2*
```
v=>[...v].map(w=>t+=('{w__^_{]|{{_^__^_^w^~]~]^__w_~]~~_^_'[parseInt(w,36)]+v).charCodeAt()%9,t=+[])|t
```
[Try it online!](https://tio.run/##vZLBTsJAEIbvPMUSA7srWChEAoeSGDTEWxO91VI2dSmYttt0lzahpCfjRR/Dh@Cu8T14krq9aQvUk5NNdrKbb/6ZzP9EIsLtcBWIC5890myhZZE2NhRFiUzFIwGKtbFoaQgmsWXNrMTcJom85ZnFs9RMTZnHlkxS@QSNgISc3voCxe3@AJutCCv2koQTWfpKINwYtYXWMky8FZnNfM5cqrjMQfCecgFswimHuPbzZ4FgF2IMTkenAwZF7LJfyUlM7RY5VVWrwENyqtr7AzYqYkMZFZzEesMit6Suy06D@XQlPV2fTKv1DnAhc0LieSvfAfp6s3EpB02Q7xVMmbvIS@bjlbizJsKeqNfT46KSKy3h/Hq/e/t6/3i5aex3z5@vxz2Qdzuo/eLhg3/H1qFNgS37Kxlq/j8Gn2OcfQM "JavaScript (Node.js) – Try It Online")
### How?
We use the ASCII code modulo 9 of characters that do not add any penalty to encode the numbers of matchsticks.
```
 char. | code | modulo 9
-------+------+-----------------
   ~   |  126 |   0
   v   |  118 |   1  (not used)
   w   |  119 |   2
   ]   |   93 |   3
   ^   |   94 |   4
   _   |   95 |   5
   {   |  123 |   6
   |   |  124 |   7
```
We do not have to worry about the case because `parseInt()` is case-insensitive.
For characters that do not match **[0-9A-Za-z]**, `parseInt()` returns `NaN` and the string lookup results in `undefined`. Once coerced to a string, `"undefined".charCodeAt()` returns the ASCII code of `"u"`, which is **117**. Conveniently, **117** modulo **9** gives **0** as expected.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 42 bytes + 0 matchsticks = 42 points
```
“ṄḟṭkɗØæ⁶ṡ“£ƈṠ¤żȥṬ}ė$t¿ƬⱮȷ|çƓ’×/ṚṚæ.ċÐ€ØW$
```
*Thanks to @JonathanAllan for -2 points!*
[Try it online!](https://tio.run/##y0rNyan8//9Rw5yHO1se7pj/cOfa7JPTD884vOxR47aHOxcCJQ4tPtbxcOeCQ0uO7jmx9OHONbVHpquUHNp/bM2jjetObK85vPzY5EcNMw9P13@4cxYQHV6md6T78IRHTWsOzwhX@f9w95bD7UBOJA0t4TLgMjXmMjQ0BGIjLgsg4MoA@iufKyDA2Z0roCg/vSgxNzczL10hoLSqKie1WEFNwTk/JVXBPT8njUtZTUMzt0RRsY5Ly@Xhjp5jSw63uao@3NFypNsAAA "Jelly – Try It Online")
### How it works
```
“ṄḟṭkɗØæ⁶ṡ“£ƈṠ¤żȥṬ}ė$t¿ƬⱮȷ|çƓ’
```
Literals that begin with `“` and end with `’` split on `“`, replace the remaining characters with their 1-based indices in Jelly's code page, then convert from bijective base 250 to integer.
This particular literal encodes 
```
[3096734725226860846495, 211369264881118657055472842435156679693648].
```
`×/` reduces by multiplication, yielding
```
654554542403034552503005456545545424030345525030054562554563760
```
(Encoding this integer directly would save 6 bytes, but cost 28 matchsticks.)
`ṚṚ` reverses twice; the first call promotes an integer to its digit array. This yields
```
[6, 5, 4, 5, 5, 4, 5, 4, 2, 4, 0, 3, 0, 3, 4, 5, 5, 2, 5, 0, 3, 0, 0, 5, 4, 5, 6, 5, 4, 5, 5, 4, 5, 4, 2, 4, 0, 3, 0, 3, 4, 5, 5, 2, 5, 0, 3, 0, 0, 5, 4, 5, 6, 2, 5, 5, 4, 5, 6, 3, 7, 6, 0]
```
`ċÐ€ØW$` counts (`ċ`) the occurrences of each (`Ð€`) character of **"A...Za...z0...9\_"** (`ØW`) in the input string.
Finally `æ.` takes the dot product, multiplying each character count by the corresponding cost in matchsticks, then taking the sum.
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 34 bytes + 3 matches = 37
```
⁽[ɱ×“®-&]Ṙṙ£⁺ÐĊṂⱮɼ ’‘ḤṚæ.ŒlċÐ€ØWṚƊ
```
A monadic link accepting a list of characters and returning an integer.
**[Try it online!](https://tio.run/##y0rNyan8//9R497okxsPT3/UMOfQOl212Ic7ZzzcOfPQ4keNuw5PONL1cGfTo43rTu5ReNQw81HDjIc7ljzcOevwMr2jk3KOdB@e8KhpzeEZ4UChY13/H@7ecnTP4XagkEoWkAAaqKBrB9Q3N/L/fwMuU2MuQ0NDIDbisgACrgyg9flcAQHO7lwBRfnpRYm5uZl56QoBpVVVOanFCmoKzvkpqQru@TlpXMpqGpq5JYqKdVxaLg939BxbcrjNVfXhjpYj3QZcVHM@AA "Jelly – Try It Online")**
### How?
Works in a similar way to [Dennis' Jelly answer](https://codegolf.stackexchange.com/a/160121/53748) but took enough effort that I feel it warrants another answer. The core difference is that it lower-cases the input for a cost of three matches (`Œl` contains an `l`) which then allows for a much smaller number to be used to create the cost array. The tricky bit was finding a way to construct that number without matches while staying concise.
`ØW` yields `"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"` so counting lower-cased input occurrences always starts with 26 zeros. We can reverse this and perform a dot-product with an array of length 37 instead of one of length 63.
```
⁽[ɱ×“®-&]Ṙṙ£⁺ÐĊṂⱮɼ ’‘ḤṚæ.ŒlċÐ€ØWṚƊ - Link: list of characters
⁽[ɱ                                - literal                                     23913
    “®-&]Ṙṙ£⁺ÐĊṂⱮɼ ’               - literal         136861653160003879166772353166783
   ×                               - multiply  = 3272772712015172762515027281277281879
                    ‘              - increment = 3272772712015172762515027281277281880
                     Ḥ             - double    = 6545545424030345525030054562554563760
                      Ṛ            - reverse (implicit decimal list) -> [0,6,7,3,6,5,4,5,5,2,6,5,4,5,0,0,3,0,5,2,5,5,4,3,0,3,0,4,2,4,5,4,5,5,4,5,6]
                                   -                     (to align with: _ 9 8 7 6 5 4 3 2 1 0 z y x w v u t s r q p o n m l k j i h g f e d c b a)
                                 Ɗ - last four links as a monad:
                         Œl        -   lower-case (the input)
                              ØW   -   word -> "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_"
                            Ð€     -   map across right:
                           ċ       -     count (right character in lower-cased input)
                                Ṛ  -   reverse (to align with the values as shown above)
                       æ.          - dot-product
```
[Answer]
# [Perl 5](https://www.perl.org/) `-p`, ~~90~~ 64 code + 9 eval harness + 14 matchsticks = 87
Replace the hex codes by their literal 1 byte variant (***not*** UTF-8 as TIO tries to) for the claimed score
```
eval~"\xdb\xa3\xd4\xc2\x86\xd0\xcf\xd2\xc6\x9e\xd2\x85\xd0\xc9\xcd\xca\xca\xcb\xca\xc9\xcc\xc8\xc9\xc9\xca\xcb\xca\xca\xcb\xca\xcb\xcd\xcb\xcf\xcc\xcf\xcc\xcb\xca\xca\xcd\xca\xcf\xcc\xcf\xcf\xca\xcb\xca\xd0\x8d\x99\x90\x8d\xdf\x93\x9c\xc2\x81\xd0\xd1\xc0\xd0\x98"}{
```
[Try it online!](https://tio.run/##XVBbCsIwELxL/1tSNZI9hDfIT16FQrFBRQJSj26cNluIfgwzm53sZBPDbZI5h6eZ3o1O3upkjuCTTu6gkzpDC@gBjNqhplC0ktwjwAOGYZnXcwco1vTXr7XlGbZkbfd2rv17Tu0Zfmetb1LwEfKItYeHsBc53qsvPg92omhSzfIqX/GZ42Ocr/fcxtxeZNeLTnwB "Perl 5 – Try It Online")
Code Inside the complemented string:
```
$\+=y/0-9a-z/625545637665455454240303455250300545/rfor lc=~/.?/g
```
[Answer]
# PHP 176 bytes = 397 score
```
<?$n="6255456376";$l="065455454240303455250300545";$a=strtolower($argv[1]);for($i=0;$i<strlen($a);$i++)$t+=(is_numeric($a[$i])?$n[$a[$i]]:$l[max((ord($a[$i])-96),0)]);echo$t;
```
[Try it online!](https://tio.run/##1Y5dCoMwEITfPUWRPBiskPqT0sbQgwQRsakGNBti@nP6pgulhyjswzc7w8662cXYXoiVKS@bpm54deSpIItMGUeJU5c1q1iFXDYIDFcYGOQWfIAFntpnZPDTQx06Km6AykgmiGkxsGiLJkWV55SEXGZm6@191d6MaChiOorl6ovdmSxqHV5ZBv76s4sTp3tG8bYeZyBBJEn8t5ff4IIBu8Xiuttm8KEHp20fhkmC/QA "PHP – Try It Online")
[Answer]
# [SOGL V0.12](https://github.com/dzaima/SOGLOnline), 34 [bytes](https://github.com/dzaima/SOGL/blob/master/chartable.md) + 18 = 52
```
ā⁄,u{²²z+;W"⁾o∫k9÷│>Γ{σ¬μ┼“'=υ─wι+
```
[Try it Here!](https://dzaima.github.io/SOGLOnline/?code=JXUwMTAxJXUyMDQ0JTJDdSU3QiVCMiVCMnorJTNCVyUyMiV1MjA3RW8ldTIyMkJrOSVGNyV1MjUwMiUzRSV1MDM5MyU3QiV1MDNDMyVBQyV1MDNCQyV1MjUzQyV1MjAxQyUyNyUzRCV1MDNDNSV1MjUwMHcldTAzQjkr,inputs=JXUwMTAxJXUyMDQ0JTJDdSU3QiVCMiVCMnorJTNCVyUyMiV1MjA3RW8ldTIyMkJrOSVGNyV1MjUwMiUzRSV1MDM5MyU3QiV1MDNDMyVBQyV1MDNCQyV1MjUzQyV1MjAxQyUyNyUzRCV1MDNDNSV1MjUwMHcldTAzQjkr,v=0.12)
[Golfed, but not scoring as much](https://dzaima.github.io/SOGLOnline/?code=MCUyQ3UlN0IlQjIlQjJ6KyUzQlclMjIldTIwN0VvJXUyMjJCazklRjcldTI1MDIlM0UldTAzOTMlN0IldTAzQzMlQUMldTAzQkMldTI1M0MldTIwMUM4JXUyNTAwdyV1MDNCOSs_,inputs=MCUyQ3UlN0IlQjIlQjJ6KyUzQlclMjIldTIwN0VvJXUyMjJCazklRjcldTI1MDIlM0UldTAzOTMlN0IldTAzQzMlQUMldTAzQkMldTI1M0MldTIwMUM4JXUyNTAwdyV1MDNCOSs_,v=0.12):
```
0,u{²²z+;W"⁾o∫k9÷│>Γ{σ¬μ┼“8─wι+
```
[Answer]
# [Ruby](https://www.ruby-lang.org/), 125 bytes + 87 matchsticks = 212
```
->m{v=->w,k{w.scan(/./).map &k};v[m,->t{v["!#&&;&=$(==&;&&;&;#;!$!$;&&#&!$!!&;&",->k{k.ord%11}][t.to_i 36].to_i+(t==?0?6:0)}].sum}
```
[Try it online!](https://tio.run/##xVHNTttAEL7zFJsNdhyyMV4bm0DlcKAVV6SqJ8uq3MSByHYc2U6gJKmEFFWqGqRU4pADUv@logoaCqFpRcShVd@DrHAeI92EBHiDrkY733zf7O7MrFd69nyYU4fJtFMpq8n0FrIqW7yfMQrcPD8f5x2jCFir9qCsOSiZDiplDUaiLMuw6iynqtRTY6JMZDYyS3GUpSBCKUiTrYrFu16WwbimawEfuE/zQFL0BBeo6oqwoiwL8ZrO@yWnNtRmANCgAJGiozGUJYiwMAkwxncKxiJES5MgRRdEYmoSbpq27dKDU3l9fXXtfui5G57hOPnCxnppZ8c2fXbVzZprrp2jV06zoiwXd4JI5AVE0wLmHl51G38//X75iLnq1v@8poXiST2x0eAcPrNpeP5oWJWqVYWCKMsLsiItKgr11BbEBUESJIpFmQKBUlCzbkcyBgnOupvLeCwxBEQF6whEwRJOUKhKsgj8jOuZt0//tz@LodTiuLTUYgKLsiri@6WZZcMGkFwcDU6O@r2j8PPHwd77fu80fEWZdnhy0d@7II02aXVI64w0z8nBD9I6H@H9zti@k2Z7ZJRpdEid2ilpjcLr9od@7@tg9yw8fEua766754P943D3W//kMGx/Id0eqV@Sg0tS/zXoHg6ax@HPTv9ND/KlQtHIWBx8Mgfj04@ykqKs1Pgb4TEVaFPyTVNyAqckVVRSk6Z03jQymyDrgmq@UCwFCJjbRTMTmNkqbdgz/ZIdABXktLGqU446H0CO8eOA8UEyTXcIGKBNc9XbG8AKgEXDp/IygDkjb0MEJo/cJOszZiE7/Ac "Ruby – Try It Online")
Heavily inspired by [Arnauld's Javascript answer](https://codegolf.stackexchange.com/a/160093/77973).
Normally the cost of declaring a lambda to be used only twice is not worth it, but the matchstick weight of "`scanap`" in `.scan(/./).map` changed that. This was a fun challenge!
```
->m{
  v=->w,k{w.scan(/./).map &k};                # v is a lambda taking a string and a block
  v[m,->t{                                    # Transform each char t of the input:
    v["!#&&;&=$(==&;&&;&;#;!$!$;&&#&!$!!&;&", # Transform each char of this magic string
      ->k{k.ord%11}                           #  into a matchstick count ([0,2,5,5,4,5...])
    ][t.to_i 36]+                             # Parse t as a base 36 index into the counts
    (t==?0?6:0)                               # If t was "0", add 6 matchsticks
  }].sum                                      # Add the counts for all characters
}
```
[Answer]
# [Python 3](https://docs.python.org/3/), 138 + 265 = 403 bytes
```
k='0123456789abcdefghijlnopqrsuxyz'
m=lambda t:sum([ord(''[k.index(v)])if v in k else 0for v in t.lower()])
```
[Try it online!](https://tio.run/##JYrdCoMgAIUh08GewjvtJtraP/QksYuaulymTa3VXt4JgwPnOx9nXH1ndBlCX5Fity8Px9P5cm3aB@Pi2cmX0mZ8Wzct65dsh0o1Q8sa7G9uGmhtLKMEJRCmEIENQrFj0iQFIFICQVyk7nOpGV/onN0zKfCMpcY95spxXAhj/8Lnyny4pfETwg8 "Python 3 – Try It Online")
[Answer]
# [MATL](https://github.com/lmendo/MATL), score ~~166~~ 156
Code length 41 + output for code used as input 115.
```
'%p#21jgyDT7o?pe}['TIW:qZajk4Y22Y2h&mXz)s
```
[Try it online!](https://tio.run/##y00syfn/X121QNnIMCu90iXEPN@@ILU2Wj3EM9yqMCoxK9sk0sgo0ihDLTeiSrP4//@Aovz0osTc3My8dIWA0qqqnNRiBTUF5/yUVAX3/Jw0AA "MATL – Try It Online")
[Answer]
# R, 112 bytes + 319 matches = 431 score
```
sum(strtoi(el(strsplit(chartr("0-9a-z","625545637665455454240303455250300545",tolower(scan(,""))),""))),na.rm=T)
```
[Try it online!](https://tio.run/##xY1dCsIwEITvsk8bSCXkT3zwFl4grYEGkkY2K6KXr1vwDsLwzce8DO21zJTojS3z2u9D7ePZcDBxL5jrYeNRC@OyJmJCMNMlTR/QEG0IPkR3jlFa4q03zjhxG0SMTKC51/7KhGNJG2oApdSPWzpRu97@cPgF)
Kudos to [Giuseppe](https://codegolf.stackexchange.com/users/67312/giuseppe) who came up with this improvement.
Old version, 143 bytes + 454 matches = 597 score
```
b=el(strsplit(chartr("0123456789abcdefghijlnopqrsuxyz","6255456376654554542433455253545",tolower(readline())),""))
sum(as.numeric(b[b%in%0:9]))
```
To make the `el()` function work on TIO, you need to use `library(methods)`.
Gosh dang it, is **R** verbose!
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 87 bytes + 26 matchsticks = 113
```
{+[+] (~'򘮉򛫡񯌞𺪯񯉒񉘁'.ords~~m:g/\w/)[m:g/<[/..{]-[\W_]>/>>.&{:٣٦(~$_)}]}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/WjtaO1ZBo07904x1nZ9mr174cX3PvA@7Vq3/uL5z0sfOGY3qevlFKcV1dblW6fox5fqa0SCGTbS@nl51rG50THh8rJ2@nZ2eWrXVzcU3l2nUqcRr1sbW/i9OrFRI0wByFNLyi7jUDdR1uNRNjUGkoaEhhDICURZAAKIzUnNy8kGMgABndzBdlJ9elJibm5mXrhBQWlWVk1qsoKbgnJ@SquCen5MGUqKspqGZW6KoWAfiaLk83NFzbMnhNlfVhztajnSDbTy85PC2w3tALJAn0tOBrMKaaoiPNQh4WZNUP9dY/wcA "Perl 6 – Try It Online")
Uses some non-ASCII Unicode characters. The lookup table is encoded in a Unicode string:
```
say '򘮉򛫡񯌞𺪯񯉒񉘁'.ords;
# (625545 637665 455454 240303 455250 300545)
```
Characters are converted to indices with base-36 conversion using Arabic-Indic numerals:
```
:٣٦('z'); # is equivalent to
:36('z');
```
[Answer]
# sed, 367 (source code bytes) + 532 (amount of matchsticks for the source code) = 899
```
s/[^0-9a-jln-suxyz]//Ig;/^$/{s/.*/0/;b};s/.+/&; %1ir %%7lnu %%%4cfhjoy %%%%235bdegpqsxz %%%%%069a %%%%%%8/;:1;s/([^% ])(.+ (%+)[^ ]*\1)/%\3 \2/I;/ ;/!b1;s/;.+//;s/^/,;/;:2;s/(;[^%]*)(%+)/\2\1/;:3;s/,%{10}/%,/;s/^%/,&/;/%{10}/b3;/;.*%/b2;:4;s/,[;,]/,0,/;/,[;,]/b4;s/%{9}/9/g;s/%{8}/8/g;s/%{7}/7/g;s/%{6}/6/g;s/%{5}/5/g;s/%%%%/4/g;s/%%%/3/g;s/%%/2/g;s/%/1/g;s/[^0-9]//g
```
[Try it Online](https://tio.run/##NZDLboJAGIX3PMWYdgwgeBjwPkvbGHfuBRKpiBoEK5p4CV013bSP0Ydw36bv4YuUDpf@yeR8OTnnn@RP/LkeRIcsSzB1Db0/09dhpCeH4@nsAOOAw73HJUFThQHupVxgA3VOKFvtCKXdMDoIoa2nxXIdn3KkptX25n6wfU6O58KgRqc/K4n2wAdMbJGnLiWOIjcbRKYNZeoSR7WZAmpbxDYx5iAcNS@PcvEjhLrQuGibeZuLuqMqeRW2aTPhW8LX6IUZKahW5Cm0OjhKz7NEualSeCYftPLslGsONENkK/Zym176KfoICuyl6FXYTdGtsJOiU2E7RbtEMWj9I6yKYJYAVmhxY3HYIMsMqW1JjDHxTKknRlr6YRhLk8lwJE12cbCbbTarKCCTw/kc@gmpk2E898koDhfSXV1WNvta7UVSH27Xj5/Pr7dHeru@fr8bv/F2v4qjJNN3fw)
Multi-line version:
```
s/[^0-9a-jln-suxyz]//Ig
/^$/{s/.*/0/;b}
s/.+/&; %1ir %%7lnu %%%4cfhjoy %%%%235bdegpqsxz %%%%%069a %%%%%%8/
:1
s/([^% ])(.+ (%+)[^ ]*\1)/%\3 \2/I
/ ;/!b1
s/;.+//
s/^/,;/
:2
s/(;[^%]*)(%+)/\2\1/
:3
s/,%{10}/%,/
s/^%/,&/
/%{10}/b3
/;.*%/b2
:4
s/,[;,]/,0,/
/,[;,]/b4
s/%{9}/9/g
s/%{8}/8/g
s/%{7}/7/g
s/%{6}/6/g
s/%{5}/5/g
s/%%%%/4/g
s/%%%/3/g
s/%%/2/g
s/%/1/g
s/[^0-9]//g
```
# Explanation:
The above script reads standard input line by line (into the pattern space -- the usual "sed way") and, for each line, it outputs the amount of matchsticks necessary to represent all the matchstick-representable characters in that line. The computations for each line of input happen as follows:
---
```
s/[^0-9a-jln-suxyz]//Ig
```
First, we remove every character for which we don't have a corresponding matchstick representation (as given on the question) from the pattern space. That is, we remove every character which isn't either a numeral from "0" to "9", a letter from "a" to "j", "n" to "s", "l", "u", "x", "y" or "z". Uppercase and lowercase letters are treated the same.
```
/^$/{s/.*/0/;b}
```
If we end up with an empty pattern space, we print 0 (automatically followed by a newline, like sed always does unless you pass a special flag to it), skip all posterior lines of the script and proceed into next "sed cycle" (i.e., read the next line of input and repeat processing all over again from the first command until there are no more lines of input to be processed).
```
s/.+/&; %1ir %%7lnu %%%4cfhjoy %%%%235bdegpqsxz %%%%%069a %%%%%%8/
```
Otherwise, if the pattern space is not empty, we now divide it into two "sub-spaces" separated by a semicolon: first comes the *input space*, which is initially formed by all characters which weren't removed from the pattern space after the execution of line 1; next comes the semicolon, and after it the *map space*.
The map space tells us how many matchsticks beside 1 are needed to represent each relevant alphanumeric character. If we want to know how many matchsticks are necessary to represent any alphanumeric character in the map space, we look for the first sequence of contiguous %'s on the left of that character, and the answer will be the number of %'s in that sequence plus 1. So, for example, the number of matchsticks necessary to represent a "b" is 4 + 1 = 5; to represent a "4", 3 + 1 = 4, to represent a "y", 3 + 1 = 4; and so on.
```
:1
s/([^% ])(.+ (%+)[^ ]*\1)/%\3 \2/I
/ ;/!b1
```
This is a loop. Now we will replace every character in the input space by the (complete) sequence of %'s whose number indicates the necessary amount of matchsticks to represent that character, and follow that sequence by a white space character (again, uppercase and lowercase letters are given the same treatment). The criterion to determine whether the loop should end is to check whether there's a white space character on the immediate left of the semicolon in the pattern space: if that condition holds, we terminate the loop and continue into the next line.
```
s/;.+//
s/^/,;/
```
Those two lines remove the semicolon and everything after it from the pattern space and then insert a comma and a semicolon into the beginning of the pattern space. We now have the pattern space divided once again into two new sub-spaces: the *analog result space* before the semicolon, and the *analog input space* after it.
The analog input space is just what we have previously called the "input space", but in a different form: it now contains sequences of %'s separated by white space. The total number of such %'s in the analog input space is the same number of matchsticks necessary to represent the initial input character string, i.e., that number is the result. But we must print that result in decimal notation, not as a sequence of percent signs. The purpose of the *analog **result** space* is to hold an analog representation of each digit of the result while we compute that result by summing each contiguous sequence of %'s in the analog input space one by one. The next loop performs that sum:
```
:2
s/(;[^%]*)(%+)/\2\1/
    :3
    s/,%{10}/%,/
    s/^%/,&/
    /%{10}/b3
/;.*%/b2
```
1. First, after label **2**, we move the next contiguous sequence of %'s after the semicolon from the analog input space into the immediate left of the semicolon, in the analog result space;
2. Next, we step into a sub-loop (label **3**) which performs the following computations:
	* If there's a contiguous sequence of ten %'s after a comma in the analog result space, we remove those %'s and put a single % immediately at the left of the comma. To put it simply, this indicates that one of the decimal places in the result has acquired more than 9 units, so we take 10 units away from that decimal place and add 1 unit to the next larger decimal place;
	* If a "%" is the first character in the pattern space, we insert a new comma immediately before it. This indicates that the sum has reached a value whose decimal representation has one more decimal place on the left than the previous value;
	* If there are still any contiguous sequence of ten %'s in the analog result space, we go back to label **3** and repeat this process. Otherwise, we exit this sub-loop and step into the next line.
3. Now, if there is still any "%" in the analog input space (i.e., after the semicolon), it means that there is still some number of matchsticks to be added to the total sum -- so we go back to label **2**.
Once the sum is complete, we step into the final loop of the code:
```
:4
s/,[;,]/,0,/
/,[;,]/b4
```
Here, we check every pair of characters formed by a comma on the left and either a semicolon or a comma on the right. We replace all such pairs of characters by a "0" inside two commas.
```
s/%{9}/9/g
s/%{8}/8/g
s/%{7}/7/g
s/%{6}/6/g
s/%{5}/5/g
s/%%%%/4/g
s/%%%/3/g
s/%%/2/g
s/%/1/g
```
The above piece of code is quite simple: we replace each contiguous sequence of %'s in the analog result space by a decimal digit character which corresponds to the number of %'s in each particular sequence.
```
s/[^0-9]//g
```
Finally, we remove every non-numeral character from the pattern space and what remains is the final result in the familiar decimal notation. That value is printed on standard output and the next sed cycle begins, if there are any more input lines to be processed.
[Answer]
# [C (gcc)](https://gcc.gnu.org/), 134 bytes + 38 matchsticks = 172
```
v(t,w)char*t;{t=(w=*t++)?v(t)+(isalnum(w|=w>'@'&w<'['?' ':!w)?")%(('()&*))('(('('%'#&#&'((%(#&##('("[w-=w>'`'?'W':'_'-'/']-'#':!w):w;}
```
[Try it online!](https://tio.run/##pZDPTsJAEMbP9imWbdqZLWwUjYkBARM0XLl5AKNNgdKkf0h3YRMQTsaLPoYPwV3je/AkdYuuXkncbLK/mflm880EPAyColigrCkWTP3ck82VbKFqebJaZR1dYFWMhB@n8wTVY0u14QpcdQkD6ACBRkWxDmUOIiBzPcb0qy84YLu2q9lBDbZO0YHiZfeD7ruFBtwDh2O442DvP2mo5rpYZNGIhFj6IJ5g1so6muVRKidIHUF4mzijYUprRNTIAgVjTWttWbpOEj9Kca8Pkf5vmOFB0wwPGIdqf6WfEwPnZ4bq9fofnhq80MfwdBzHmQn6/W7vl/MszP0kidKQ9OfLZTwWxCXdbDQmvSyeGJntIktkpbIxCe96t339fHt/vnF226ePl29Xs7kUSDnnRvazHROWWyx5XXwB "C (gcc) – Try It Online")
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E), 30 bytes + 70 matches = 100 score
```
žLÃlv•Ƶγ¤и©X´≠Ø&c3Íεç•žhA«ykèO
```
[Try it online!](https://tio.run/##MzBNTDJM/f//6D6fw805ZY8aFh3bem7zoSUXdhxaGXFoy6POBYdnqCUbH@49t/XwcqDs0X0ZjodWV2YfXuFPmqYciK5afwA "05AB1E – Try It Online")
---
-5 thanks to Emgina
[Answer]
# Java 10, ~~452~~ ~~432~~ ~~416~~ 404 score (145 bytes + 259 matches)
```
k->{int m=0,t;for(var w:k)for(t=m-m;t<'';)m+="1ir 7lnu 4cfhjoy 235bdegpqsxz 069a 8".split(" ")[t++].contains((char)(w|32)+"")?-~t:t-t;return m;}
```
**Explanation:**
[Try it online.](https://tio.run/##lZPNThsxEMdvPeQpBlclNumu8gGFsk0RCohTo0gcWQ7OZpNs4o/Ung0kITkhLu1j9CG4t@I9eJLgBLgFVPtg2WP/xv/xzAz4mAeDznCZCG4t/OCZmhUAMoWp6fIkheZquzZAQpM@NxeXYFnkjPOCmyxyzBJogoI6LIfB99nqpqyXP2PU1YaOuYGrwyFbrbEuAxnht@KHYsRkqU4qmYF9oXLYTbr9gZ5AtbbX7qS90U97PYXyl68cDkhoRyJDSoCwCyyVLsNEK3QyLV3LYfTqplZlJULYUbDAQwwwMinmRoGM5stoJXKUt4UT@aJ1rLMOSOeBnqPJVM8FxNlzlOcTi6kMdY7hyB2hUFSFCSVlEqJuuNeOjeETytj6A96@v1fzBCqVijdR9SQO3PBE@qkQ2pNptRpnvojRPcOldMmAVj6ditTCNjR0J4UzLbqe3j5uUyZxa2vhye2cPN7/fvjz9@700@P97b9fvkn3K/74v6o/fi3/mED8fgPEJN7YAhujmBfmyyc)
```
k->{                   // Method with character-array parameter and int return-type
  int m=0,             //  Result-integer, starting at 0
      t;               //  Index-integer
  for(var w:k)         //  Loop over the input String-array
    for(t=m-m;t<'';)   //   Inner loop over the parts array with index [0,6)
      m+="1ir 7lnu 4cfhjoy 235bdegpqsxz 069a 8".split(" ")[t++]
                       //     If the current part ordered by amount of matches (2-8)
         .contains((char)(w|32)+"")?
                       //     contains the current (lowercase) letter
          -~t          //      Increase the result by the index + 2
         :             //     Else:
          t-t;         //      The result remains the same by adding 0
  return m;}           //  Return the result
```
* ~~Variable names `$ραετ` are used instead of letters.~~ EDIT: Variable names `kmtvw` are now used instead, because they can't be formed by matches according to the challenge description.
* `''` (unprintable) is used instead of `6`.
* `m-m` and `t-t` are used instead of `0`.
* `(char)(w|32)+""` with character-array input used instead of `w.toLowerCase()` with String-array input.
[Answer]
# [AutoHotkey](https://autohotkey.com/docs/AutoHotkey.htm), 148 bytes + 345 matchsticks = 493
This one was a bit of a challenge to shorten.
```
n:=["1ir","7lnu","4cfhjoy","235bdegpqsxz","09a5",7+1]
Loop Parse,i
{r:=A_LoopField
Loop % n.Length()
{l:=A_Index
if InStr(n[l],r)
u+=l+1
}}
send % u
```
[Answer]
# [Python 3](https://docs.python.org/3/), 123 bytes + 65 matches = 188
```
lambda w,m='',t='',k=ord:sum(~-k((m+t+m+''+t)[k(v)%77])*('/'<v<'{')for v in w)
```
An unnamed function accepting a string and returning an integer.
Contains many non-printable characters (specifically bytes one to eight).
**[Try it online!](https://tio.run/##dVDNTsJAEE5Df4SnWDA4u7QoSAyGUC9ouHJXDygtNOy2pF1KxIST8aKP4UNw1/gePEndaSUkJk42@8337Tc7s7t4krMo7GSP0cRzASDjY/EwGZOVI1zQdMM0S6ama5ppmOBIJeVhKaqWUTI0HZy5G8WTXrIUdNOcUypsaQtbOa0Smiz9yNLAlux2TlNW73bvWYPCGfTTPjwD86OYpCQIyYplqn8FByEuQThNZBwsKNyFwCq@66VjTlFXRBVJL5FYR2utmkNqFx3c2@12AecIlyoQZx7nESaj0WCYYxxN47EQQTglo@V6zb2EnJABth5G3EfL8QllQlarGySN6932/fvj8/Wmvtu@fL1hx5aTD8l6lXLg59OobJ8St3gCSuVFHISSouwQaF6BQ7gXFi9Rgq24n58icw@M2AcfU/d4PPnvvt8K5dqbCo/6uuafyD8z@wE "Python 3 – Try It Online")**
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 48 bytes + 3 = 51
```
ＩΣＥθ⎇№α↥ιＩ§”)➙⊞←!Σw➙⊙↘⁴↘”⌕α↥ι∧№ＩＸ²φιＩ§”)⧴u↑$◨”Ｉι
```
[Try it online!](https://tio.run/##S85ILErOT8z5/z@gKDOvRMM5sbhEI7g0V8M3sUCjUEchJLUoL7GoUsM5vxQom6ijEFpQkFqUnFicqpGpqamjAFbvWOKZl5JaoaFkZmpiCkQmRiYGxgbGQLaRKZBhABRS0lFwy8xLwTABZIYjUBxiPti0gPzy1CINIx0FQwMDA5B8JqY9RiBrzIzNzZSgUmCjQMD6///3e1aeW/x@z9JzOx71tT9qmXZu46O2ped2AoUPLX/UMFfz0byZj7rmPWqboHhucTmYM/NR24xHjVtAZMPcRz1ToToedSwHagfqe79nx6FN59uQzVi@pfRR20SVR9NXALkgG3f@1y3LAQA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
ＩΣＥθ
```
Loop over the characters of the input, calculating the number of matchsticks of each, then sum the result, convert to string, and implicitly print.
```
⎇№α↥ι
```
If it's a letter...
```
Ｉ§”)➙⊞←!Σw➙⊙↘⁴↘”⌕α↥ι
```
Look up the number of matchsticks in the compressed string `65455454240303455250300545`.
```
∧№ＩＸ²φι
```
Else if it appears in the value of `2 ** 1000`...
```
Ｉ§”)⧴u↑$◨”Ｉι
```
Look up the number of matchsticks in the compressed string `6255456376`.
[Answer]
# PHP, 98+253=351
```
for(;$k=ord($argn[$v++]);)$m+=$k>64?_65455454240303455250300545[$k&31]:_6255456376[$k-47];print$m;
```
Run as pipe with `-nr` or [try it online](http://sandbox.onlinephpfunctions.com/code/42f0db179dcf858be62bdd9962c814f75e2d7ecd).
]