Time limit
1s
Memory limit
128 MB
Jaeseok makes number signs that are attached to front doors. Each sign contains an address number, and it needs fixed margins between digits and at both ends. Different digits also take different widths.
The rules are as follows.

For the number 120 shown above, there are two gaps between digits. The digit widths are 2 cm for 1, 3 cm for 2, and 4 cm for 0. Adding the 2 cm of outer margins gives a total width of 2 + 2 + 3 + 4 + 1 + 1 = 13 cm.
For each given address number, determine the total width needed for its number sign.
Each line contains one number N to be written on a sign. N satisfies 1 <= N <= 9999.
Input continues until a line containing 0 appears. The final 0 is a terminator and must not be processed.
For each number, output the total width required for its number sign as an integer.
Print the answers in input order, one per line.