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 pb push_back
#define mp make_pair
#define int long long
#define inf 1000000007
#define LINF 1000000000000000007mope
#define ll long long
using namespace std;
map<int,int> mope;
signed main(){
	int d;
	cin>>d;
	if( d%9 != 0 ){
		cout<<0<<endl;
		return 0;
	}
	for(int i=0;i<=9;i++){
		for(int j=0;j<=9;j++){
			mope[i-j]++;
		}
	}
	int ans = 0;
	for(int i=2;i<=18;i++){ // i digits;
		vector<int> p10;
		p10.pb(1);
		for(int j=2;j<=i;j++){
			p10.pb( p10[p10.size()-1] * 10);
		}
		vector<int> v;
		for(int j=0;j<p10.size()/2;j++){
			v.pb( p10[i-1-j] - p10[j] );
		}
		int mx = 1<<(v.size()); // 0 small 1 big
		for(int j=0;j<mx;j++){
			int bt = j;
			int cur = 0;
			int pat = 1;
			for(int k=0;k<v.size();k++){
				int ch = bt%2; bt /= 2;
				int dif = d - cur;
				int nxt = abs(dif) / v[k];
				nxt = nxt + ch;
				if( dif < 0 ) nxt = -nxt;
				cur = cur + nxt * v[k];
				if( k == 0 && nxt >= 0 ) pat *= max(0LL,mope[nxt]-1);
				else pat *= mope[nxt];
			}
			if( d == cur ){
				if( i%2 == 0 )ans += pat;
				else ans += pat*10;
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}