X + R(X) = N#6746

X + R(X) = N

0.75 seconds
256 megabytes
Hard

Ruslan is crazy about counting numbers and solving problems. His favourite pastime is to make up a problem and solve it by himself. Some time ago he heard about a very interesting problem: given the positive integer , you have to say whether such that X + R(X) = N exists or not, where is a positive integer, and is the number X written backwards. Then, Ruslan has decided that this task is elementary, so he didn't start solving it, but made up a more difficult problem instead.

You are given the positive integer number . How many positive integer numbers are there, that X + R(X) = N?

is the number written backwards. For example: R(123) = 321, R(150) = 51.

Input

Input will consist of multiple test cases. Each case will be a single line containing number (1 \leq N \leq 10^{10000}). A line with a single zero terminates the input.

Maximum size of input is bytes.

Output

Output for each test case should consist of a single integer on a line, indicating the number of numbers satisfying the condition. Do not output leading zeros.

Examples

Example 1

Loading
Loading