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>

#define fo(i,j,l) for(int i=j;i<=l;++i)
#define fd(i,j,l) for(int i=j;i>=l;--i)
#define dz(o) ((o)<0?(-(o)):(o))

using namespace std;
typedef long long ll;
const ll N=20;

ll D,ten[N],sx;

ll ask(ll ws,ll d)
{
	if(ws==0)return (d==0);
	else if(ws==1) return d?0:10;
	int r=(d%10)==0?0:d%10-10;
	ll k=((d%10)==0?10:d%10)-(ws==sx);
	return k*ask(ws-2,dz(d+r*ten[ws]-r)/10);
}

int main()
{
	cin>>D; ll K=D;
	int u,cs=0; ll ans=0;
	for(;K;K/=10)++cs;
	for(ten[1]=1,u=2;u<=(cs<<1);++u)ten[u]=ten[u-1]*10;
	fo(i,cs,cs<<1)sx=i,ans=ans+ask(i,D);
	cout<<ans;
}