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;
typedef long long ll;
int n;
int sta[40],tot;
int a[40];
int main(){
    scanf("%d",&n);
    while(n){
        sta[++tot]=n%10,n/=10;
    }
    ll ans=0;
    for(int mask=0;mask<(1<<(tot*2-1));mask++){
        for(int i=1;i<=tot*2;i++)a[i]=sta[i];
        for(int i=0;i<tot*2-1;i++){
            if(mask>>i&1)a[i+1]-=10,a[i+2]+=1;
        }
        ll res=1;
        int s=1;
        while(s<=tot*2&&a[s]==0)s++;
        int t=tot*2;
        while(t>=s&&a[t]==0)t--;

        bool f=true;
        for(int i=s;i<=t;i++)if(a[i]+a[s+t-i])f=false;
        for(int i=s;i<=t;i++)if(a[i]<-9||a[i]>9)f=false;
        if(a[t]<0)f=false;
        if(f==false)continue;
        for(int i=1;i<=(s+t)/2;i++){
            if(i==1)res*=9-abs(a[i]);
            else res*=10-abs(a[i]);
        }
        /*
        cout<<mask<<endl;
        cout<<s<<' '<<t<<endl;
        for(int i=s;i<=t;i++)cout<<a[i]<<' ';
        cout<<endl;
        */
        ans+=res;
    }
    printf("%lld\n",ans);
    return 0;
}