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;
const int maxn=1e5+5;
const int inf=0x3f3f3f3f;
long long a[maxn];
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
    long long d;
    cin>>d;
    a[0]=1;
    for(int i=1;i<=20;i++)
    	a[i]=a[i-1]*10;
    long long ans=0;
    for(int i=2;i<=20;i++)
    {
    	int k=i/2;
    	for(long long state=0;state<1<<k;state++)
    	{
    		long long cha,chan=d;
    		if(i%2==1)
    			cha=10;
    		else
    			cha=1;
    		for(int j=0;j<k;j++)
    		{
    			long long x=abs(chan)%10;
    			if(chan<0)
    			{
    				x=10-x;
    				x%=10;
				}
				if(state>>j&1)
				{
					long long sym=10-x;
					if(j==0)
						sym--;
					cha*=sym;
					chan+=x*a[i-2*j-1];
					chan-=x;
				}
				else
				{
					long long sym=x;
					if(j==0)
						sym--;
					if(sym<0)
					{
						cha=0;
						break;
					}
					cha*=sym;
					chan-=(10-x)*a[i-2*j-1];
					chan+=(10-x);
				}
				chan/=10;
			}
			if(chan==0)
				ans+=cha;
		}
	}
	cout<<ans<<endl;
	return 0;
}
