Changeling
Very hard
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
Number of P is said to be inverted in the number N, if the inverted decimal entry coincides with one decimal another. For example, inverted for 3489 will be 9843, but to 2009100 will be 0019002 or, excluding leading zeros, just 19002. Given a positive integer N. Find the largest number of M such that it will, when added with its inverted, will give a fixed number N.
Input
The first line contains one integer N (1 <= N <= 10^100^{ }^000).
Output
Bring one number - the answer to the question of the problem. If the desired number does not exist, output a 0.
Examples
Input #1
Answer #1
Submissions 278
Acceptance rate 1%