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 <stdio.h>
#include <iostream>
#include <algorithm>
#include <memory.h>

using namespace std;
typedef long long LL;
const int maxn = 100005;
const int N = 18;

LL pw[maxn],ans,d; 
void solve(int stp,LL num,LL res,bool fir) {
	if (stp<=1) {
		if (stp) res*=10-fir;
		if (!num) ans+=res;
		return ;
	}
	LL mul=pw[stp-1]-1;
	for (int i=fir?0:-9;i<=9;i++) {
		LL _=num-mul*i;
		if (_%10||abs(_)>pw[stp]) continue;
		solve(stp-2,_/10,res*(10-abs(i)-fir),0);
	}
}
int main()
{
	#ifdef Amberframe
		freopen("arc075f.in","r",stdin);
		freopen("arc075f.out","w",stdout);
	#endif
	scanf("%lld",&d);pw[0]=1ll;
	for (int i=1;i<=N;i++) pw[i]=pw[i-1]*10;
	for (int i=1;i<=N;i++) solve(i,d,1,1);
	printf("%lld",ans);
	return 0;
}