#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <ctime>
#include <algorithm>
using namespace std;

int read() {
    int x = 0, f = 1; char c = getchar();
    while(!isdigit(c)){ if(c == '-') f = -1; c = getchar(); }
    while(isdigit(c)){ x = x * 10 + c - '0'; c = getchar(); }
    return x * f;
}

#define maxn 15
#define LL long long

int d;
LL ans;

int main() {
    d = read();
    
    if(d % 9) return puts("0"), 0;
    d /= 9;
    LL ini = 0, ten = 1;
    for(int i = 1; i <= 17; i++) {
        LL tmp = 1, D = d;
        ini = ini * 10 + 1;
        LL base = ini, lten = ten, rten = 1;
        for(int j = 0; j <= (i >> 1); j++) 
        {
            tmp *= 10 - abs(D % (rten * 10) / rten) - (!j ? 1 : 0);
            D -= base * (D % (rten * 10) / rten);
            base -= lten + rten;
            lten /= 10; rten *= 10;
        }
        ten *= 10;
        if(!D) ans += tmp;
    }
    printf("%lld\n", ans);
    
    return 0;
}
### Prompt

Construct a CPP code solution to the problem outlined:

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 <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <ctime>
#include <algorithm>
using namespace std;

int read() {
    int x = 0, f = 1; char c = getchar();
    while(!isdigit(c)){ if(c == '-') f = -1; c = getchar(); }
    while(isdigit(c)){ x = x * 10 + c - '0'; c = getchar(); }
    return x * f;
}

#define maxn 15
#define LL long long

int d;
LL ans;

int main() {
    d = read();
    
    if(d % 9) return puts("0"), 0;
    d /= 9;
    LL ini = 0, ten = 1;
    for(int i = 1; i <= 17; i++) {
        LL tmp = 1, D = d;
        ini = ini * 10 + 1;
        LL base = ini, lten = ten, rten = 1;
        for(int j = 0; j <= (i >> 1); j++) 
        {
            tmp *= 10 - abs(D % (rten * 10) / rten) - (!j ? 1 : 0);
            D -= base * (D % (rten * 10) / rten);
            base -= lten + rten;
            lten /= 10; rten *= 10;
        }
        ten *= 10;
        if(!D) ans += tmp;
    }
    printf("%lld\n", ans);
    
    return 0;
}
```