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

// Problem : F - Mirrored
// Contest : AtCoder Regular Contest 075
// URL : https://atcoder.jp/contests/arc075/tasks/arc075_d
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define cerr if(1)cerr
#define size(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int N = 1e6 + 1, mod = 1e9 + 7, inf = 2e9;

int d;
ll pw = 1, ans = 0;

ll solve(ll d, ll p, bool leading) {
	if (!p) return !d;
	ll ans = 0;
	int c = (d % 10 + 10) % 10;
	ans += (10 - c - leading) * solve((d - c * p) / 10, p / 100, 0);
	ans += (c - leading) * solve((d + (10 - c) * p) / 10, p / 100, 0);
	return ans;
}

int main() { cin.tie(0)->sync_with_stdio(0);
	cin >> d;
	if (d % 9) {
		return cout << 0, 0;
	}
	d /= 9;
	for (int i = 2; i <= 18; i++) {
		pw *= 10;
		ll res = solve(d, pw / 9, 1);
		if (i & 1) {
			res *= 10;
		}
		ans += res;
	}
	cout << ans;
}
