Juicy Joint Ventures
You and your friend Patrick have just stumbled upon the next big thing. Both of you have quit your day jobs to create a company that makes cold-pressed juice. This expensive, overengineered, internet-connected machine will only work with your proprietary QR-coded produce packs, which don't actually need the machine to squeeze out. This doesn't sound familiar at all...
As the programmer of the group, you're tasked with designing the system that will only allow the proprietary juice packs from being used.
The QR code on your produce packs encode a string which only contains digits 0 through 9 and the character *, which may represent any digit. This means that the string could represent many different numbers because of the wildcard. To verify that the produce pack isn't a 3rd party pack, the machine needs to sum up all possible numbers that this string could represent, and then send that number back to a server. Can you help develop the algorithm for this?
Input
The first and only line consists of the QR code's data. This string will be between 1 and 7 characters long.
Output
Output a single integer, the sum of all of the numbers the string may represent.
Clarifications
The string may represent numbers with leading zeroes, such as **123 representing 00123 which becomes the number . These are counted in the sum.
The answer is guaranteed to fit within a 32 bit integer.
Example
Input 1
*344*
Output 1
4844450
Input 2
*
Output 2
45
Comments