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<algorithm>
using namespace std;
typedef long long ll;
int i,j,k,n,d;
ll ans,tm10[22];
ll dfs(int x,ll y) {
	if (n-x-1<x) {
		if (y==d) return 1;
		return 0;
	}
	if (x==n-x-1) {
		if (x==0) return 9ll*dfs(x+1,y);
		return 10ll*dfs(x+1,y);
	}
	ll t=(tm10[n-x-1]-tm10[x])/9;
	ll ans=0;
	for (int i=-9;i<=9;i++) if (i*t+y>=0 && (i*t+y)%tm10[x+1]==d%tm10[x+1]) {
		int tt=10-abs(i);
		if (x==0 && i>=0) tt--;
		if (tt) ans+=tt*dfs(x+1,t*i+y);
	}
	return ans;
}
int main() {
	tm10[0]=1;
	for (i=1;i<=18;i++) tm10[i]=10ll*tm10[i-1];
	scanf("%d",&d);
	if (d%9) return puts("0"),0;
	d/=9;
	for (n=1;n<=18;n++) ans+=dfs(0,0ll);
	printf("%lld\n",ans);
}