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;

long long int N, M, a, b, r = 1, s, i, j, l;

int decimaldigits(long long A){
    int j, k;
    for(j = 0, k = 1; k < A; ++j, k *= 10);
    return j;
}

int main(){
    scanf("%lld", &N);
    if(N % 9)return 0 & puts("0");
    N /= 9;
    M = N;
    for(l = 0; l < 30; ++l){
        a = decimaldigits(N) + l;
        for(i = 0; a >= 0; a -= 2, ++i){
            if(a == 0 && N != 0){r = 0; break;}
            r *= (i ? 10 : 9) - N % 10;
            b = ((long long int)pow(10, a) - 1) / 9 * (N % 10);
            N = abs(N - b);
            N /= 10;
            //cout << a << " " << r << " " << b << " " << N << endl;
        }
        if(N != 0)r = 0;
        s += r;
        r = 1;
        N = M;
    }
    cout << s;
    return 0;
}
