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>
#define REP(i,n) for(LL i=0;i<(LL)(n);i++)
#define ALL(x) (x).begin(),(x).end()
#define LL long long
#define pii pair<LL,LL>
#define pll pair<LL,LL>

using namespace std;

LL D;
map<LL,LL> cnt0;
map<LL,LL> cnt1;

LL comb(LL k,LL d){
    LL nine=1;
    REP(i,k)nine*=10;
    nine--;
    vector<LL> ele;
    while(nine>0){
        LL p=(10-(abs(d)%10))*(d>0 ? -1:1);
        if(abs(p)==10)p=0;
        d = (d +p*nine)/10;
        ele.push_back(-p);
        nine/=100;
    }
    LL res=0;
    if(d==0){
        res=cnt0[ele[0]];
        for(LL i=1;i<ele.size();i++)res*=cnt1[ele[i]];
        if(k%2==0)res*=10;
    }
    return res;

}

int main(){

    cin>>D;
    for(LL i=1;i<10;i++){
        REP(j,10){
            cnt0[j-i]=cnt0[j-i]+1;
        }
    }
    REP(i,10)REP(j,10)cnt1[i-j]=cnt1[i-j]+1;

    LL ans=0;
    for(LL i=1;i<20;i++)ans+=comb(i,D);
    cout<<ans<<endl;

    return 0;
}