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
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)

ll dp[11][2][2];
char s[20];

int main(){
	scanf("%s", s);
	int n = strlen(s);
	f(i, 0, n)s[i] -= '0';
	reverse(s, s + n);
	ll an = 0;
	int t = n;
	f(tmp, 0, t + 1){
		f(i, 0, 11)f(j, 0, 2)f(k, 0, 2)dp[i][j][k] = 0;
		dp[0][0][0] = 1;
		f(i, 0, n + 1 >> 1)f(a, 0, 2)f(b, 0, 2)f(k, 0, 10)f(w, 0, 2){
			ll &r = dp[i][a][b];
			int j = n - i - 1;
			if (j == i){
				if (w)continue;
				int z = k + s[i] + a;
				bool c = z >= 10;
				if (c)z -= 10;
				if (z == k && c == b)dp[i + 1][c][c] += r;
			}else {
				int z = k + s[i] + a;
				bool c = z >= 10;
				if (c)z -= 10;
				if (i == 0 && z == 0)continue;
				z += s[j] + w;
				bool d = z >= 10;
				if (d)z -= 10;
				if (z == k && d == b)dp[i + 1][c][w] += r;
			}
		}
		f(i, 0, 2)an += dp[n + 1 >> 1][i][i];
		++n;
	}
	printf("%lld\n", an);
}