#include<cstdio>
typedef long long ll;
int cnt,d,mi[20];
int reverse(int x,int len){
	int ans=0;
	for (int i=1;i<=len;i++) ans=ans*10+x%10,x/=10;
	return ans;
}
int main()
{
	scanf("%d",&d);
	mi[0]=1;
	for (int i=1;i<=9;i++) mi[i]=mi[i-1]*10;
	ll ans=0;
	if (d%10){
		for (int bit=1;bit<=7;bit++)
		for (int i=0;i<mi[bit];i++){
			ll j=(i+d)%mi[bit];
			if (j%10==0) continue;
			ll ri=reverse(i,bit),rj=reverse(j,bit);
			if (rj*mi[bit]+i+d==ri*mi[bit]+j) ans++;
			if (rj*mi[bit+1]+i+d==ri*mi[bit+1]+j) ans+=10;
		}
	}
	else{
		int pw=1;
		while (d%10==0) d/=10,pw*=10;
		pw=pw/10*9;
		for (int bit=1;bit<=7;bit++)
		for (int i=0;i<mi[bit];i++){
				ll j=(i+d)%mi[bit];
				ll ri=reverse(i,bit),rj=reverse(j,bit);
				if (rj*mi[bit]+i+d==ri*mi[bit]+j) ans++;
				if (rj*mi[bit+1]+i+d==ri*mi[bit+1]+j) ans+=10;
		}
		ans*=pw;
	}
	printf("%lld\n",ans);
	return 0;
}
### Prompt

Please formulate 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>
typedef long long ll;
int cnt,d,mi[20];
int reverse(int x,int len){
	int ans=0;
	for (int i=1;i<=len;i++) ans=ans*10+x%10,x/=10;
	return ans;
}
int main()
{
	scanf("%d",&d);
	mi[0]=1;
	for (int i=1;i<=9;i++) mi[i]=mi[i-1]*10;
	ll ans=0;
	if (d%10){
		for (int bit=1;bit<=7;bit++)
		for (int i=0;i<mi[bit];i++){
			ll j=(i+d)%mi[bit];
			if (j%10==0) continue;
			ll ri=reverse(i,bit),rj=reverse(j,bit);
			if (rj*mi[bit]+i+d==ri*mi[bit]+j) ans++;
			if (rj*mi[bit+1]+i+d==ri*mi[bit+1]+j) ans+=10;
		}
	}
	else{
		int pw=1;
		while (d%10==0) d/=10,pw*=10;
		pw=pw/10*9;
		for (int bit=1;bit<=7;bit++)
		for (int i=0;i<mi[bit];i++){
				ll j=(i+d)%mi[bit];
				ll ri=reverse(i,bit),rj=reverse(j,bit);
				if (rj*mi[bit]+i+d==ri*mi[bit]+j) ans++;
				if (rj*mi[bit+1]+i+d==ri*mi[bit+1]+j) ans+=10;
		}
		ans*=pw;
	}
	printf("%lld\n",ans);
	return 0;
}
```