#include<bits/stdc++.h>
using namespace std;
long long N;
int depth;
inline long long number1(int len)
{
	long long ret=0;
	long long cnt=9;
	for(int i=0;i<len;i++)
	{
		ret+=cnt;
		cnt*=10;
	}
	return ret;
}
long long dfs(int i,long long diff)
{
	if(i==depth/2)
	{
//		cout<<"YES"<<diff<<endl;
		if(!diff)
			return 1;
		return 0;
	}
	long long delta=number1(depth-i-i-1);
	if(diff<0)
	{
		long long tmp=abs(diff);
		long long unit=tmp%10;
//		cout<<(diff+delta*((10-unit)%10))<<endl;
		return dfs(i+1,(diff+delta*((10-unit)%10))/10ll)*(unit+(!unit)*10);
	}
	else
	{
		long long unit=diff%10;
//		cout<<(diff-delta*((10-unit)%10))<<endl;
		return dfs(i+1,(diff-delta*((10-unit)%10))/10ll)*(unit+(!unit)*10-(!i));
	}
}
long long Count(int len)
{
	depth=len;
	long long ret=dfs(0,N);
	if(len%2)
		ret*=10;
//	cout<<len<<" "<<ret<<endl;
	return ret;
}
int main()
{
	cin>>N;
	if(N%9)
	{
		puts("0");
		return 0;
	}
	long long Ans=0;
	for(int i=2;i<=18;i++)
		Ans+=Count(i);
	cout<<Ans<<endl;
	return 0;
}
### Prompt

Create a solution in cpp for 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 N;
int depth;
inline long long number1(int len)
{
	long long ret=0;
	long long cnt=9;
	for(int i=0;i<len;i++)
	{
		ret+=cnt;
		cnt*=10;
	}
	return ret;
}
long long dfs(int i,long long diff)
{
	if(i==depth/2)
	{
//		cout<<"YES"<<diff<<endl;
		if(!diff)
			return 1;
		return 0;
	}
	long long delta=number1(depth-i-i-1);
	if(diff<0)
	{
		long long tmp=abs(diff);
		long long unit=tmp%10;
//		cout<<(diff+delta*((10-unit)%10))<<endl;
		return dfs(i+1,(diff+delta*((10-unit)%10))/10ll)*(unit+(!unit)*10);
	}
	else
	{
		long long unit=diff%10;
//		cout<<(diff-delta*((10-unit)%10))<<endl;
		return dfs(i+1,(diff-delta*((10-unit)%10))/10ll)*(unit+(!unit)*10-(!i));
	}
}
long long Count(int len)
{
	depth=len;
	long long ret=dfs(0,N);
	if(len%2)
		ret*=10;
//	cout<<len<<" "<<ret<<endl;
	return ret;
}
int main()
{
	cin>>N;
	if(N%9)
	{
		puts("0");
		return 0;
	}
	long long Ans=0;
	for(int i=2;i<=18;i++)
		Ans+=Count(i);
	cout<<Ans<<endl;
	return 0;
}
```