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;

long long d,e[18],ans;

long long solve(int l,int r,long long d){
	if (l>=r&&d) return 0;
	if (l==r) return 10-(l==0);
	if (l==r+1) return 1;
	int t=(10-d%10)%10;
	return (10-(l==0)-t)*solve(l+1,r-1,abs(d-t*(e[r-l]-1))/10);
}

int read(){
	int x=0,f=1;char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-')  f=-f;
	for (;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	return x*f;
}

int main(){
	d=read();
	for (int i=e[0]=1;i<18;i++) e[i]=e[i-1]*10;
	for (int i=0;i<18;i++) ans+=solve(0,i,d);
	printf("%lld\n",ans);
	return 0;
}