Wise man

아직 제출이 없습니다시간 제한1초메모리 제한64 MB

문제

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 AA. Every following day, your number AA will be changed in following way: A=(A+A = (A + biggestDigit(A))biggestDigit(A)) modmod MM. Can you predict the number at the NN-th day? 

The function biggestDigit(A)biggestDigit(A) returns the digit with the biggest value in the number AA. For example: biggestDigit(172)=7biggestDigit(172) = 7.

입력

The single line of input contains three numbers, AA (1A<M)(1 \leq A < M), MM (1M1018)(1\leq M \leq 10^{18}) and NN (1N1018)(1\leq N \leq 10^{18}).

출력

In the single line, print the value of AA at the NN-th day.