#include<cstdio>
#include<algorithm>
#define ll long long
using namespace std;
const ll MX=1e17;
int m;ll pw;
int cal(ll n,ll m){
	if (n==1) return m==0?10:0;
	if (n==0) return m==0;
	if (m>10*n-9) return 0;
	int d=(10-m%10)%10;
	int v=10-d-(n==pw);
	return v*cal(n/100,abs(m-n*d+d)/10);
}
int main(){
	scanf("%d",&m);int ans=0;
	for (pw=1;pw*10<=m;pw*=10);
	for (;pw<=MX;pw*=10) ans+=cal(pw,m);
	printf("%d",ans);
}
### Prompt

Generate 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<algorithm>
#define ll long long
using namespace std;
const ll MX=1e17;
int m;ll pw;
int cal(ll n,ll m){
	if (n==1) return m==0?10:0;
	if (n==0) return m==0;
	if (m>10*n-9) return 0;
	int d=(10-m%10)%10;
	int v=10-d-(n==pw);
	return v*cal(n/100,abs(m-n*d+d)/10);
}
int main(){
	scanf("%d",&m);int ans=0;
	for (pw=1;pw*10<=m;pw*=10);
	for (;pw<=MX;pw*=10) ans+=cal(pw,m);
	printf("%d",ans);
}
```