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 ll long long

const int N = 20;

ll ans = 0;
int d;
int a[N];
ll power[N], coe[N], suf[N];

void dfs(int dep, int sz, ll now, bool flag){
	if (dep == sz){
		if (now == d){
			ll ret = 1;
			for (int i = 0; i < sz; ++ i){
				ret *= 10 - std::abs(a[i]) - !i;
			}
			if (flag){
				ret *= 10;
			}
			ans += ret;
		}
		return;
	}
	if (std::abs(now - d) > suf[dep]){
		return;
	}
	for (int i = -9; i <= 9; ++ i){
		a[dep] = i;
		dfs(dep + 1, sz, now + coe[dep] * i, flag);
	}
}

int main(){
	power[0] = 1;
	for (int i = 1; i <= 18; ++ i){
		power[i] = power[i - 1] * 10;
	}
	scanf("%d", &d);
	for (int i = 2; i <= 18; ++ i){
		for (int j = 0; j < i >> 1; ++ j){
			coe[j] = power[i - j - 1] - power[j];
		}
		for (int j = (i >> 1) - 1; ~j; -- j){
			suf[j] = suf[j + 1] + coe[j] * 9;	
		}
		dfs(0, i >> 1, 0, i & 1);
	}
	return printf("%lld\n", ans), 0;
}