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 <iostream>
#include <stdlib.h>
#define llint long long

using namespace std;

llint d;
llint beki[19];

llint get(llint n, llint k)
{
	return (beki[n-k] - beki[k]) / 9;
}
llint dfs(llint p, llint n, llint x)
{
	//cout << p << " " << n << " " << x << endl;
	if(p >= (n+1)/2){
		if(x == d){
			if(n%2 == 0) return 10;
			else return 1;
		}
		else return 0;
	}
	llint ret = 0;
	for(int i = -9; i <= 9; i++){
		llint y = x + get(n, p)*i;
		//cout << x << " " << get(n, p) << " " << y << endl;
		if(y < 0 || y/beki[p]%10 != d/beki[p]%10) continue;
		llint cnt = 10-abs(i);
		if(p == 0 && i >= 0) cnt--;
		ret += dfs(p+1, n, y) * cnt;
	}
	return ret;
}

int main(void)
{
	cin >> d;
	if(d % 9){
		cout << 0 << endl;
		return 0;
	}
	d /= 9;
	
	beki[0] = 1;
	for(int i = 1; i <= 18; i++) beki[i] = beki[i-1] * 10;
	
	llint ans = 0;
	for(int i = 1; i <= 18; i++) ans += dfs(0, i, 0);
	cout << ans << endl;
	
	return 0;
}