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
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define maxn 1000
ll D;
ll ans=0;
ll pw10[20];
int num[20];
int num1[20];
void dfs(int l,int r,ll tmp,ll cnt,bool z){
	if(l>r){
		if(tmp==D)ans+=cnt;
		return;
	}
	if(l==r){
		if(tmp==D)ans+=10*cnt;
		return;
	}
	if(abs(tmp-D)>pw10[r+1]) return;
	int now=z?0:-9;
	for(int i=now;i<=9;++i)dfs(l+1,r-1,tmp+(pw10[r]-pw10[l])*i,z?cnt*num1[i+10]:cnt*num[i+10],0);
}
int main(){
	cin>>D;
	pw10[0]=1;
	for(int i=1;i<=19;++i)
		pw10[i]=pw10[i-1]*10LL;
	ll tmp=D;
	int cnt=0;
	for(int i=0;i<10;++i)
		for(int j=0;j<10;++j)
			num[i-j+10]++;
	for(int i=1;i<10;++i)
		for(int j=1;j<=i;++j)
			num1[i-j+10]++;
	while(tmp>0)cnt++,tmp/=10;
	for(int i=cnt-1;i<=19;++i)dfs(0,i,0,1,1);
	cout<<ans<<"\n";
	return 0;
}
