Shifty Sum
Time limit1sMemory limit512 MB
Given N and k, print N + 10N + ... + 10^k N.
- Level
Easy1 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Problem
Take a number such as 12. Shifting a number means appending one zero to its end. Shifting 12 once gives 120, and shifting the result again gives 1200. You may shift a number as many times as you want.
In this problem you compute a shifty sum: the sum of a number and of the numbers obtained by shifting it. You are given a starting number and a non-negative integer . Add together and every number obtained by shifting once, twice, and so on up to times, that is .
For example, the shifty sum of with is .
Input
The first line contains the number . ()
The second line contains , the number of times to shift . ()
Output
Print one integer, the shifty sum of with shifts.