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 <iostream>
using namespace std;
typedef long long ll;

ll D;

ll hoge(ll A,ll t,int first) {
	if(t==0) return A==0;
	int v=(A%10+10)%10;
	ll ret=0;
	ret+=(10-v-first)*hoge((A-t*v)/10,t/100,0);
	ret+=(v-first)*hoge((A+(10-v)*t)/10,t/100,0);
	return ret;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>D;
	if(D%9) { cout<<0<<endl; return; }
	D/=9;
	ll ret=0;
	ll p10=10;
	for(i=2;i<=18;i++) {
		p10*=10;
		
		ll tot=(i%2)?10:1;
		ret += tot*hoge(D,p10/10/9,1);
	}
	cout<<ret<<endl;
	
}

int main() {
	solve();
}