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<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
#define N 20
#define LL long long
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
LL i,k,lim,D,ans;
LL _10[N];
LL Abs(LL x){return x>0?x:-x;}
LL dg(LL w,LL d){
	if(!w)return (d==0);else
	if(w==1)return d?0:10;
	LL x=(d%10)==0?0:10-d%10;
	LL j=(d%10)==0?10:d%10;
	if(w==k)j--;
	return dg(w-2,Abs(d-x*_10[w]+x)/10)*j;
}
int main(){
	scanf("%lld",&D);lim=log10(D)+1;
	_10[1]=1;fo(i,2,19)_10[i]=_10[i-1]*10;
	fo(i,lim,lim*2)k=i,ans+=dg(i,D);
	printf("%lld",ans);
	return 0;
}