#include<bits/stdc++.h>
using namespace std;


long long int dfs(int len,long long int tar,bool start){
	if(len==0)
		return tar==0;
	else if(len==1)
		return tar==0?(10-start):0;
	long long int tmp=1;
	for(int i=1;i<len;i++)
		tmp=tmp*10;
	tmp-=1;
	long long int res=0;
	for(int i=-9;i<=9;i++){
		if((tar-tmp*i)%10==0){
			res+=dfs(len-2,(tar-tmp*i)/10,false)*(10-abs(i)-(start&&i>=0));
		}
	}
	return res;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	long long int d;
	cin>>d;
	long long int ans=0;
	for(int i=1;i<=19;i++)
		ans+=dfs(i,d,true);
	cout<<ans<<endl;
}

### Prompt

Please create a solution in CPP 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<bits/stdc++.h>
using namespace std;


long long int dfs(int len,long long int tar,bool start){
	if(len==0)
		return tar==0;
	else if(len==1)
		return tar==0?(10-start):0;
	long long int tmp=1;
	for(int i=1;i<len;i++)
		tmp=tmp*10;
	tmp-=1;
	long long int res=0;
	for(int i=-9;i<=9;i++){
		if((tar-tmp*i)%10==0){
			res+=dfs(len-2,(tar-tmp*i)/10,false)*(10-abs(i)-(start&&i>=0));
		}
	}
	return res;
}

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	long long int d;
	cin>>d;
	long long int ans=0;
	for(int i=1;i<=19;i++)
		ans+=dfs(i,d,true);
	cout<<ans<<endl;
}

```