#include<stdio.h>
#include<stdlib.h>
#define ll long long
const int Inf=1e9+10;
int gi(){
	int sum=0,f=1;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch<='9' && ch>='0'){sum=sum*10+ch-'0';ch=getchar();}
	return sum*f;
}
int d;
ll ans;
int main(){
	int i,j,k,n,m;
	scanf("%d",&d);
	if(d%9){
                printf("0\n");
		return 0;
	}
	d/=9;
	ll len=1,ini=0;
	for(i=1;i<=17;i++){
		ll tmp=1,D=d;
		ini=ini*10+1;
		ll base=ini,lten=len,rten=1;
		for(int j=0;j<=(i>>1);j++){
			tmp*=10-abs(D%(rten*10)/rten)-(!j?1:0);
			D-=base*(D%(rten*10)/rten);
			base-=lten+rten;
			lten/=10;rten*=10;
		}
		len*=10;
		if(!D)ans+=tmp;
	}
	printf("%lld\n",ans);
	return 0;
}

### 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<stdio.h>
#include<stdlib.h>
#define ll long long
const int Inf=1e9+10;
int gi(){
	int sum=0,f=1;char ch=getchar();
	while(ch>'9' || ch<'0'){if(ch=='-')f=-1;ch=getchar();}
	while(ch<='9' && ch>='0'){sum=sum*10+ch-'0';ch=getchar();}
	return sum*f;
}
int d;
ll ans;
int main(){
	int i,j,k,n,m;
	scanf("%d",&d);
	if(d%9){
                printf("0\n");
		return 0;
	}
	d/=9;
	ll len=1,ini=0;
	for(i=1;i<=17;i++){
		ll tmp=1,D=d;
		ini=ini*10+1;
		ll base=ini,lten=len,rten=1;
		for(int j=0;j<=(i>>1);j++){
			tmp*=10-abs(D%(rten*10)/rten)-(!j?1:0);
			D-=base*(D%(rten*10)/rten);
			base-=lten+rten;
			lten/=10;rten*=10;
		}
		len*=10;
		if(!D)ans+=tmp;
	}
	printf("%lld\n",ans);
	return 0;
}

```