Given a string of digits, define an operation to be incrementing some digit in the string. Increasing any digit that is not nine increases it by one. Increasing nine switches it to zero and also automatically increases the digit to its left, if any such digit exists, which may cascade and cause digits to its left to also be incremented, but these automatic increases are considered part of the original operation.
Given a string of digits, compute the minimum number of operations needed to make the string a palindrome.
~1 \le |S| \le 40~
The input consists of a single line containing the string ~S~.
Print, on a single line, the minimum number of operations needed to make the string a palindrome.
Sample Input 1
Sample Output 1
Sample Input 2
Sample Output 2
Sample Input 3
Sample Output 3