#include <cstdio>
#include <cstring>
#define LL long long

LL D,p10[100];

LL dfs(int l,LL d,int flag){
	if(l<=1){
		if(d!=0) return 0;
		if(!l) return 1;
		return flag?10:9;
	}
	if(d%10!=0 && l>=17) return 0;
	LL temp=(d%10+10)%10;
	LL ans=0;
	if(temp<=9)
		ans+=(9-temp+flag)*dfs(l-2,(d-temp*(1-p10[l-1]))/10,1);
	if(temp-10>=-9)
		ans+=(temp-1+flag)*dfs(l-2,(d-(temp-10)*(1-p10[l-1]))/10,1);
	return ans;
}

int main(){
#ifdef DEBUG
	freopen("F.in","r",stdin);
#endif
	p10[0]=1;
	for(int i=1;i<100;i++) p10[i]=p10[i-1]*10;
	scanf("%lld",&D);
	LL ans=0;
	for(int i=1;i<=30;i++)
		ans+=dfs(i,D,0);
	printf("%lld\n",ans);
}

### Prompt

Your task is to create a Cpp solution to 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 <cstdio>
#include <cstring>
#define LL long long

LL D,p10[100];

LL dfs(int l,LL d,int flag){
	if(l<=1){
		if(d!=0) return 0;
		if(!l) return 1;
		return flag?10:9;
	}
	if(d%10!=0 && l>=17) return 0;
	LL temp=(d%10+10)%10;
	LL ans=0;
	if(temp<=9)
		ans+=(9-temp+flag)*dfs(l-2,(d-temp*(1-p10[l-1]))/10,1);
	if(temp-10>=-9)
		ans+=(temp-1+flag)*dfs(l-2,(d-(temp-10)*(1-p10[l-1]))/10,1);
	return ans;
}

int main(){
#ifdef DEBUG
	freopen("F.in","r",stdin);
#endif
	p10[0]=1;
	for(int i=1;i<100;i++) p10[i]=p10[i-1]*10;
	scanf("%lld",&D);
	LL ans=0;
	for(int i=1;i<=30;i++)
		ans+=dfs(i,D,0);
	printf("%lld\n",ans);
}

```