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<cstdio>
#include<cstring>
#include<algorithm>
#define ll long long
#define MN 20
using namespace std;
inline ll in(){
    ll x=0;bool f=0; char c;
    for (;(c=getchar())<'0'||c>'9';f=c=='-');
    for (x=c-'0';(c=getchar())>='0'&&c<='9';x=(x<<3)+(x<<1)+c-'0');
    return f?-x:x;
}
ll ans,d,pw[MN],dig;
inline ll absol(ll x){return (x>0ll)?x:-x;}
inline ll dfs(ll x,int l,int len){
	if (l>=len-l) {return x?0:((l==len-l)?10:1);}
	ll wy=(10-x%10)%10,rem=x-(wy*pw[len-(l<<1)]-wy);
	return ((l?10:9)-wy)*dfs(absol(rem)/10,l+1,len);
}
int main()
{
	d=in();for (int t=d;t;t/=10) ++dig;pw[0]=1;
	for (int i=1;i<=(dig<<1);++i) pw[i]=pw[i-1]*10ll; 
	for (int i=0;i<=(dig<<1);++i) ans+=dfs(d,0,i);
	printf("%lld",ans);return 0;
}