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;
#define ll long long
vector<ll> g,v;
map<ll,ll> ANS,mp,mp1;
ll ans = 0,d,pw10[20],digit;
ll solve(int n,ll d) {
	if (n == 1)	{
		if (d == 0) return 10;
		return 0;
	}
	if (n == 0) return d == 0;
	ll x = pw10[n-1] - 1;
	for (int i = -9; i <= 9; i++) {
		if ( abs(d - x*i) < pw10[n-1] ) {
			if ((d - x*i)%10 == 0) {
				ll f = 0;
				if (digit == n) f = mp1[i];
				else f = mp[i];
			return solve(n-2,(d - x*i)/10)*f;
		}
		}
	}
	return 0;
}
int main() {
	ll d;
	cin >> d;
	pw10[0] = 1;
	for (int i = 1; i <= 18; i++) 
		pw10[i] = pw10[i-1]*10;
	for (int i = 0; i <= 9; i++)
	for (int j = 0;j  <= 9; j++)
		mp[i-j]++;
	for (int i = 1; i <= 9; i++)
	for (int j = 1; j <= 9; j++) {
		mp1[i-j]++;
	}
	ll ans = 0;
	for (int i = 1; i <= 18; i++) {
		digit = i;
		ans += solve(i,d);
	}
	cout << ans;
}