Wise man
시간 제한1초메모리 제한64 MB
A에서 시작해 매일 A를 (A + A의 가장 큰 자릿수) mod M으로 바꿀 때, N번째 날의 값을 구합니다.
문제
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 . Every following day, your number will be changed in following way: . Can you predict the number at the -th day?
The function returns the digit with the biggest value in the number . For example: .
입력
The single line of input contains three numbers, , and .
출력
In the single line, print the value of at the -th day.