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;
 
 
int n,i,j,d;
long long p[105];
 
long long solve(int l, int r, long long now){
	if(l >= r){
		if(l == r){
			if(now == 0LL){
				if(l == 0) return 9LL;
				return 10LL;
			}
			return 0LL;
		}
		
		if(now == 0LL) return 1LL;
		return 0LL;
	}
	
	long long tot = 0;
	
	long long v1 = now % 10;
	long long v2;
	if(v1 < 0){
		v2 = v1 + 10;
	}
	else
	v2 = v1 - 10;
	
	int num1 = 10 - abs(v1);
	int num2 = 10 - abs(v2);
	
	if(l == 0) num2--;
	if(v1 == 0 && l == 0) num1--;
	
	tot += solve(l + 1, r - 1, (now - v1 + v1 * p[r - l]) / 10) * num1;
	if(v1 != 0)
	tot += solve(l + 1, r - 1, (now - v2 + v2 * p[r - l]) / 10) * num2;
	
	return tot;
}
 
int main(){
	
	scanf("%d", &d);
	
	p[0] = 1LL;
	
	for(i = 1; i <= 18; i++)
	p[i] = p[i - 1] * 10LL;
	
	long long res = 0LL;
	
	for(i = 1; i <= 18; i++)
	res += solve(0, i - 1, d);
	
	printf("%lld\n", res);
}