| Krosh Kaliningrad Contest 2 |
|---|
| Finished |
Consider some number without leading zeroes(but 0 is allowed). We neee to obtain new number which is divisible by three. In one move we can take any digit of this number and decrease it(if it is not 0) or increase it by 1(if it is not 9). Resulting number should not contain leading zeroes(but 0 is allowed). What is the minimum number of such moves to get a number which is divisible by three?
You are given number n (0 ≤ n ≤ 1018).
Output answer to the problem.
12
0
124
1
0
0
123456788
1
| Name |
|---|


