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
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define mem(x, y) memset(x, y, sizeof(x))
#define pii pair<int, int>
#define pli pair<LL, int>
#define mkp make_pair
const int N = 20;
int D, a[N], n, mask[N];
LL ans;

int cal(int i) {
    return a[i] + (i ? mask[i - 1] : 0) - mask[i] * 10;
}

void go(int L) {
    int tot = 1 << L;
    for(int ma = 0; ma < tot; ma++) {
        for(int k = 0; k < L; k++) mask[k] = ma >> k & 1;
        if(mask[L - 1]) continue;
        LL res = 1;
        for(int k = 0; k * 2 < L; k++) {
            int i = k, j = L - 1 - i;
            int F = cal(i), S = cal(j);
            if(F + S != 0) res = 0;
            else {
                if(F > 0) res *= (10 - F);
                else res *= max(0, (10 - S - (!k)));
            }
        }
        ans += res;
    }
}

int main()
{
    scanf("%d", &D);
    while(D) a[n++] = D % 10, D /= 10;
    while(n <= N) go(n++);
    printf("%lld\n", ans);
    return 0;
}

