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 int long long
using namespace std;
int rt[30];
signed main()
{
	int d;
	scanf("%lld",&d);
	rt[0]=1;
	for(int i=1;i<30;i++)
		rt[i]=rt[i-1]*10ll;
	int ret=0;
	for(int i=2;i<=20;i++)
	{
		int k=i/2;
		for(int s=0;s<(1<<k);s++)
		{
			int way=i%2==1?10:1,zan=d;
			for(int j=0;j<k;j++)
			{
				int dd=abs(zan)%10ll;
				if(zan<0)
				{
					dd=10-dd;
					dd%=10;
				}
				if(s>>j&1)
				{
					int nm=10ll-dd;
					if(j==0)
						nm--;
					way*=nm;
					zan+=dd*rt[i-2*j-1];
					zan-=dd;
				}
				else
				{
					int nm=dd;
					if(j==0)
						nm--;
					if(nm<0)
					{
						way=0;
						break;
					}
					way*=nm;
					zan-=(10ll-dd)*rt[i-2*j-1];
					zan+=(10ll-dd);
				}
				zan/=10ll;
			}
			if(zan==0)
				ret+=way;
		}
	}
	cout<<ret;
	return 0;
} 