#arc075d. [arc075_d]Mirrored

[arc075_d]Mirrored

Problem Statement

For a positive integer nn, we denote the integer obtained by reversing the decimal notation of nn (without leading zeroes) by rev(n)rev(n). For example, rev(123)=321rev(123) = 321 and rev(4000)=4rev(4000) = 4.

You are given a positive integer DD. How many positive integers NN satisfy rev(N)=N+Drev(N) = N + D?

Constraints

  • DD is an integer.
  • 1D<1091 ≤ D < 10^9

Input

Input is given from Standard Input in the following format:

DD

Output

Print the number of the positive integers NN such that rev(N)=N+Drev(N) = N + D.


Sample Input 1

63

Sample Output 1

2

There are two positive integers NN such that rev(N)=N+63rev(N) = N + 63: N=18N = 18 and 2929.


Sample Input 2

75

Sample Output 2

0

There are no positive integers NN such that rev(N)=N+75rev(N) = N + 75.


Sample Input 3

864197532

Sample Output 3

1920