- Time limit: 1.00 s
- Memory limit: 512 MB
Uolevi got a number n as a birthday present. However Uolevi noticed that the number is not lucky. Uolevi thinks that a number is lucky if it is divisible by 7 and the sum of any two adjacent digits is divisible by 7.
Compute how many digits of the number Uolevi has to modify to transform it into a lucky number. Leading zeros are not allowed.
Input
Input contains one integer, n.
Output
Output one integer, minimum number of digit modifications to n so that it will be a lucky number.
Constraints
- 1 \le n < 10^{100}
Example
Input:
932
Output:
1
You can modify the number to 952, which is a lucky number.