#include<bits/stdc++.h>

#define ll long long
#define reg register
#define rep(i, a, b) for(int i = a; i <= b; ++i)

using namespace std;
int d, N = 17;
ll ans, a, b = 1;
int main() {
    scanf ("%d", &d);
    if (d % 9) {
        puts("0");
        return 0;
    }
    d /= 9;
    rep (i, 1, N) {
        reg ll res = 1, Tmp = d, all = a * 10 + 1, l = b, r = 1;
        rep (j, 0, i / 2) {
            reg ll tmp = Tmp % (r * 10) / r;            
            reg ll x = 10 - abs(tmp);
            if (!j) x--;
            res *= x, Tmp -= all * tmp, all -= l + r, l /= 10, r *= 10;
        }
        b *= 10, a = a * 10 + 1;
        if(!Tmp) ans += res;
    }
    printf ("%lld\n", ans);
    return 0;
}
### Prompt

Develop a solution in cpp to the problem described below:

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

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

Constraints

* D is an integer.
* 1 ≤ D < 10^9

Input

Input is given from Standard Input in the following format:


D


Output

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

Examples

Input

63


Output

2


Input

75


Output

0


Input

864197532


Output

1920

### Response

```cpp
#include<bits/stdc++.h>

#define ll long long
#define reg register
#define rep(i, a, b) for(int i = a; i <= b; ++i)

using namespace std;
int d, N = 17;
ll ans, a, b = 1;
int main() {
    scanf ("%d", &d);
    if (d % 9) {
        puts("0");
        return 0;
    }
    d /= 9;
    rep (i, 1, N) {
        reg ll res = 1, Tmp = d, all = a * 10 + 1, l = b, r = 1;
        rep (j, 0, i / 2) {
            reg ll tmp = Tmp % (r * 10) / r;            
            reg ll x = 10 - abs(tmp);
            if (!j) x--;
            res *= x, Tmp -= all * tmp, all -= l + r, l /= 10, r *= 10;
        }
        b *= 10, a = a * 10 + 1;
        if(!Tmp) ans += res;
    }
    printf ("%lld\n", ans);
    return 0;
}
```