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 <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long LL;

int n,D,d[20],g[20];

LL ans,ten[20];

void dfs(int x,LL m,LL s)
{
	if (x==n/2)
	{
		if (m==D)
		{
			if (n&1) ans+=s*10;else ans+=s;
		}
		return;
	}
	for (int i=-9;i<10;i++)
	{
		LL cur=m+(ten[n-1-x]-ten[x])*i;
		if (D%ten[x+1]==(cur%ten[x+1]+ten[x+1])%ten[x+1])
		{
			int pl=g[i+9];
			if (x==0) pl--;
			dfs(x+1,cur,s*pl);
		}
	}
}

int main()
{
	scanf("%d",&D);
	ten[0]=1;
	for (int i=1;i<19;i++) ten[i]=ten[i-1]*10;
	for (int i=0;i<10;i++) for (int j=0;j<10;j++) g[i-j+9]++;
	for (n=1;n<=18;n++) dfs(0,0,1);
	printf("%lld\n",ans);
	return 0;
}