#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	LL D; cin >> D;
	if(D%9 != 0) return cout << 0 << endl, 0;
	D /= 9;
	LL ans = 0;
	repp(i,1,19){
		LL z = 1;
		repp(k,0,i) z *= 10;
		LL x = D;
		LL a = 1;
		LL b = 1;
		while(z > 0){
			a *= 10-x%10-b;
			if(z == 1) break;
			x -= x%10*(z-1)/9;
			if(x < 0) x = -x;
			x /= 10;
			z /= 100;
			b = 0;
		}
		if(x == 0) ans += a;
	}
	cout << ans << endl;
	return 0;
}

### Prompt

In CPP, your task is to solve the following problem:

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

### Response

```cpp
#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

int main(){
	LL D; cin >> D;
	if(D%9 != 0) return cout << 0 << endl, 0;
	D /= 9;
	LL ans = 0;
	repp(i,1,19){
		LL z = 1;
		repp(k,0,i) z *= 10;
		LL x = D;
		LL a = 1;
		LL b = 1;
		while(z > 0){
			a *= 10-x%10-b;
			if(z == 1) break;
			x -= x%10*(z-1)/9;
			if(x < 0) x = -x;
			x /= 10;
			z /= 100;
			b = 0;
		}
		if(x == 0) ans += a;
	}
	cout << ans << endl;
	return 0;
}

```