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 <algorithm>
#define R register
#define ll long long
using namespace std;

ll base[40];
int D;
int ans=0;
int st[40];

inline void dfs(int now,int len,ll sum)
{
	if(now>=len/2+1)
	{
		if(sum!=D) return ;
		int tans=st[1]>=0?(9-st[1]):(9+st[1]);
		for(R int i=2;i<now;i++) tans=tans*(st[i]>=0?(10-st[i]):(10+st[i]));
		ans+=len&1?tans*10:tans;
		return ;
	}
	if(sum+10ll*(base[len-now]-base[now-1])<D) return ;
	if(sum-10ll*(base[len-now]-base[now-1])>D) return ;
	for(R int ss=(now==1?-8:-9);ss<=(now==1?8:9);ss++)
	{
		st[now]=ss;
		dfs(now+1,len,sum+st[now]*(base[len-now]-base[now-1]));
	}
	return ;
}

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