#include<bits/stdc++.h>
using namespace std;
int t,len;
long long x,ans,y,pw[20]={1},ret;
long long solve(int len){
	y=x,ret=1;
	if(len==0)return 0;
	for(int i=0;i<((len+1)/2);++i){
		long long p=pw[len-i]-pw[i];
		long long x=-y/p;
		y%=p;
		if(y>=0){
			if(y%pw[i+1]!=0)y-=p,x--;
			if(y%pw[i+1]!=0||abs(x)>=10)return 0;
		//	printf("<%lld,%lld,%lld>\n",x,p,y);
			ret*=10-abs(x)-(!i);
		} else {
			if(y%pw[i+1]!=0)y+=p,x++;
			if(y%pw[i+1]!=0||abs(x)>=10)return 0;
		//	printf("<%lld,%lld,%lld>\n",x,p,y);
			ret*=10-abs(x)-(!i&&x==0);
		}
	}
	if(y)return 0;
	if(len%2==0)ret*=10;
//	printf("<%d>",len);
	return ret;
}
int main(){
//	scanf("%d",&t);
	t=1;
	for(int i=1;i<=18;++i)pw[i]=pw[i-1]*10;
	while(t--){
		scanf("%lld",&x);
		y=x,ans=0,len=0;
		if(x%9!=0){printf("0\n");continue;}
		while(y)y/=10,len++;
		for(int i=len-1;i<len*2;++i)ans+=solve(i);
		printf("%lld\n",ans);
	}
}
### Prompt

In Cpp, your task is to solve 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;
int t,len;
long long x,ans,y,pw[20]={1},ret;
long long solve(int len){
	y=x,ret=1;
	if(len==0)return 0;
	for(int i=0;i<((len+1)/2);++i){
		long long p=pw[len-i]-pw[i];
		long long x=-y/p;
		y%=p;
		if(y>=0){
			if(y%pw[i+1]!=0)y-=p,x--;
			if(y%pw[i+1]!=0||abs(x)>=10)return 0;
		//	printf("<%lld,%lld,%lld>\n",x,p,y);
			ret*=10-abs(x)-(!i);
		} else {
			if(y%pw[i+1]!=0)y+=p,x++;
			if(y%pw[i+1]!=0||abs(x)>=10)return 0;
		//	printf("<%lld,%lld,%lld>\n",x,p,y);
			ret*=10-abs(x)-(!i&&x==0);
		}
	}
	if(y)return 0;
	if(len%2==0)ret*=10;
//	printf("<%d>",len);
	return ret;
}
int main(){
//	scanf("%d",&t);
	t=1;
	for(int i=1;i<=18;++i)pw[i]=pw[i-1]*10;
	while(t--){
		scanf("%lld",&x);
		y=x,ans=0,len=0;
		if(x%9!=0){printf("0\n");continue;}
		while(y)y/=10,len++;
		for(int i=len-1;i<len*2;++i)ans+=solve(i);
		printf("%lld\n",ans);
	}
}
```