#include<bits/stdc++.h>
using namespace std;
long long mi[233];
long long work(int l,int r,long long dlt)
{
	if ((l>=r)&&(dlt)) return 0;
	if (l==r) return 10-(l==0);
	if (l>r) return 1;
	int t=(10-dlt%10)%10;
	dlt-=t*(mi[r-l]-1);
	return (10-(l==0)-t)*work(l+1,r-1,abs(dlt)/10);
}
int main()
{
	mi[0]=1;for (int i=1;i<=18;i++) mi[i]=mi[i-1]*10;
	int d;scanf("%d",&d);long long ans=0;
	for (int i=0;i<=17;i++) ans+=work(0,i,d);
	cout<<ans+(d==0)<<endl;
}  
### 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;
long long mi[233];
long long work(int l,int r,long long dlt)
{
	if ((l>=r)&&(dlt)) return 0;
	if (l==r) return 10-(l==0);
	if (l>r) return 1;
	int t=(10-dlt%10)%10;
	dlt-=t*(mi[r-l]-1);
	return (10-(l==0)-t)*work(l+1,r-1,abs(dlt)/10);
}
int main()
{
	mi[0]=1;for (int i=1;i<=18;i++) mi[i]=mi[i-1]*10;
	int d;scanf("%d",&d);long long ans=0;
	for (int i=0;i<=17;i++) ans+=work(0,i,d);
	cout<<ans+(d==0)<<endl;
}  
```