시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 64 MB1811853.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.

예제 입력 1

2014 2015 1

예제 출력 1

2014

예제 입력 2

14 25 115

예제 출력 2

16