#include<bits/stdc++.h>
using namespace std;
#define LL long long

int n,D,d[99],x[99],c1[99],c2[99];
LL Ans,Pi;

int main()
{
#ifdef h10
	freopen("mirrored.in","r",stdin);
	freopen("mirrored.out","w",stdout);
#endif
	int i,j,S,tmp;
	bool flag;
	for (i=0;i<10;i++)
	for (j=0;j<10;j++) c1[i-j+10]++;
	for (i=0;i<10;i++)
	for (j=1;j<10;j++) c2[i-j+10]++;

	scanf("%d",&D);
	for (tmp=D;tmp;tmp/=10) d[n++]=tmp%10;

	for (S=0;S<1<<n<<n;S++)
		if (S>>(n+n-1))
		{
			memset(x,0,sizeof(x));
			for (i=0;i<n+n;i++)
				if ((S>>i)&1) x[i]+=d[i];
				else x[i]-=10-d[i],x[i+1]++;

			flag=1;
			for (i=0;i<n+n;i++)
				flag&=x[i]!=10&&x[i]!=-10;
			for (i=n+n-1;i>=0;i--)
			{
				flag=1;
				for (j=0;j<=i;j++)
					flag&=x[j]+x[i-j]==0;
				if (flag||x[i]) break;
			}
			if (!flag) continue;

			Pi=1; j=i;
			for (i=(j+1)/2;i<j;i++)
				Pi*=c1[x[i]+10];
			Pi*=c2[x[j]+10];
			Ans+=Pi;
		}
	printf("%lld\n",Ans);
}

### 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>
using namespace std;
#define LL long long

int n,D,d[99],x[99],c1[99],c2[99];
LL Ans,Pi;

int main()
{
#ifdef h10
	freopen("mirrored.in","r",stdin);
	freopen("mirrored.out","w",stdout);
#endif
	int i,j,S,tmp;
	bool flag;
	for (i=0;i<10;i++)
	for (j=0;j<10;j++) c1[i-j+10]++;
	for (i=0;i<10;i++)
	for (j=1;j<10;j++) c2[i-j+10]++;

	scanf("%d",&D);
	for (tmp=D;tmp;tmp/=10) d[n++]=tmp%10;

	for (S=0;S<1<<n<<n;S++)
		if (S>>(n+n-1))
		{
			memset(x,0,sizeof(x));
			for (i=0;i<n+n;i++)
				if ((S>>i)&1) x[i]+=d[i];
				else x[i]-=10-d[i],x[i+1]++;

			flag=1;
			for (i=0;i<n+n;i++)
				flag&=x[i]!=10&&x[i]!=-10;
			for (i=n+n-1;i>=0;i--)
			{
				flag=1;
				for (j=0;j<=i;j++)
					flag&=x[j]+x[i-j]==0;
				if (flag||x[i]) break;
			}
			if (!flag) continue;

			Pi=1; j=i;
			for (i=(j+1)/2;i<j;i++)
				Pi*=c1[x[i]+10];
			Pi*=c2[x[j]+10];
			Ans+=Pi;
		}
	printf("%lld\n",Ans);
}

```