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;

typedef long long ll;
ll D,ans;
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>D;
	if(D%9){
		cout<<0<<'\n';
		return 0;
	}
	D/=9;ll pw=1;
	for(int i=1;i<=17;++i){
		ll tmp=1,d=D,lp=pw,rp=1;pw*=10;
		ll b=(pw-1)/9;
		for(int j=0;j+j<=i;++j){
			tmp*=10-abs(d%(rp*10)/rp)-!j;
			d-=b*(d%(rp*10)/rp);
			b-=lp+rp;lp/=10;rp*=10;
		}
		if(!d)ans+=tmp;
	}
	cout<<ans<<'\n';
	return 0;
}
