Given N and k, print N + 10N + ... + 10^k N.
Easy1MathImplementationNo attempts yetTime limit1sMemory limit512 MBTake 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 N and a non-negative integer k. Add together N and every number obtained by shifting N once, twice, and so on up to k times, that is N+10N+100N+⋯+10kN.
For example, the shifty sum of N=12 with k=1 is 12+120=132.
The first line contains the number N. (1≤N≤10000)
The second line contains k, the number of times to shift N. (0≤k≤5)
Print one integer, the shifty sum of N with k shifts.