시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
---|---|---|---|---|---|
1 초 (추가 시간 없음) | 64 MB | 18 | 11 | 8 | 53.333% |
Dzoni, a wise man from Serbia, knows the answers for all of the world's questions except one ?! Can you solve this question for him:
On the first day you are given a number $A$. Every following day, your number $A$ will be changed in following way: $A = (A + $ $biggestDigit(A))$ $mod$ $M$. Can you predict the number at the $N$-th day?
The function $biggestDigit(A)$ returns the digit with the biggest value in the number $A$. For example: $biggestDigit(172) = 7$.
The single line of input contains three numbers, $A$ $(1 \leq A < M)$, $M$ $(1\leq M \leq 10^{18})$ and $N$ $(1\leq N \leq 10^{18})$.
In the single line, print the value of $A$ at the $N$-th day.
2014 2015 1
2014
14 25 115
16