#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using namespace std;
typedef long long ll;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 1e5 + 5;
int D,len;
ll ans,res,d,pw[20],num[20];
int main()
{
	pw[0]=1;
	for(int i=1;i<=18;i++)
		pw[i]=pw[i-1]*10;
	rg ll tmp;
	cin>>D;
	if(D%9)
	{
		puts("0");
		return 0;
	}
	D/=9;
	tmp=D;
	while(tmp)
	{
		len++;
		tmp/=10;
	}
	for(int i=max(len,2);i<=2*len;i++)
	{
		memset(num,0,sizeof(num));
		tmp=(pw[i-1]-1)/9;
		d=D+tmp;
		num[i]=1;
		for(int j=1;j<=i/2;j++)
		{
			if(d<0)
			{
				num[i-j+1]=(-d)%10;
				d=(d+tmp*num[i-j+1])/10;
			}
			else 
			{
				num[j]=d%10;
				d=(d-tmp*num[j])/10;
			}
			tmp/=100;
		}
		if(d)
			continue;
		res=1;
		for(int j=1;j<=(i+1)/2;j++)
			res*=9-max(num[j],num[i-j+1])+min(num[j],num[i-j+1])+(j!=1);
		ans+=res;
	}
	cout<<ans<<endl;
	return 0;
}

### Prompt

Create a solution in Cpp for the following problem:

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

### Response

```cpp
#include <bits/stdc++.h>
#define Inf 0x3f3f3f3f
#define rg register
using namespace std;
typedef long long ll;
inline ll min(ll x, ll y) { return x < y ? x : y; }
inline ll max(ll x, ll y) { return x > y ? x : y; }
const int Maxn = 1e5 + 5;
int D,len;
ll ans,res,d,pw[20],num[20];
int main()
{
	pw[0]=1;
	for(int i=1;i<=18;i++)
		pw[i]=pw[i-1]*10;
	rg ll tmp;
	cin>>D;
	if(D%9)
	{
		puts("0");
		return 0;
	}
	D/=9;
	tmp=D;
	while(tmp)
	{
		len++;
		tmp/=10;
	}
	for(int i=max(len,2);i<=2*len;i++)
	{
		memset(num,0,sizeof(num));
		tmp=(pw[i-1]-1)/9;
		d=D+tmp;
		num[i]=1;
		for(int j=1;j<=i/2;j++)
		{
			if(d<0)
			{
				num[i-j+1]=(-d)%10;
				d=(d+tmp*num[i-j+1])/10;
			}
			else 
			{
				num[j]=d%10;
				d=(d-tmp*num[j])/10;
			}
			tmp/=100;
		}
		if(d)
			continue;
		res=1;
		for(int j=1;j<=(i+1)/2;j++)
			res*=9-max(num[j],num[i-j+1])+min(num[j],num[i-j+1])+(j!=1);
		ans+=res;
	}
	cout<<ans<<endl;
	return 0;
}

```