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
// ====================================
//   author: M_sea
//   website: https://m-sea-blog.com/
// ====================================
#include <bits/stdc++.h>
#define file(x) freopen(#x".in","r",stdin); freopen(#x".out","w",stdout)
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef long long ll;

int read() {
	int X=0,w=1; char c=getchar();
	while (c<'0'||c>'9') { if (c=='-') w=-1; c=getchar(); }
	while (c>='0'&&c<='9') X=X*10+c-'0',c=getchar();
	return X*w;
}

int d,cnt[19],ans=0;
ll pw[19];

void dfs(int p,ll s,int c,int lim) {
	if (p>=lim/2) {
		if (s==d) ans+=c*(lim&1?10:1);
		return;
	}
	int x=-9;
	while (x<9&&s+(x+1)*(pw[lim-p-1]-pw[p])<=d) ++x;
	dfs(p+1,s+x*(pw[lim-p-1]-pw[p]),c*(p==0&&x>=0?cnt[x+9]-1:cnt[x+9]),lim);
	if (++x<=9) dfs(p+1,s+x*(pw[lim-p-1]-pw[p]),c*(p==0&&x>=0?cnt[x+9]-1:cnt[x+9]),lim);
}

int main() {
	d=read();
	for (int i=0;i<=9;++i)
		for (int j=0;j<=9;++j) ++cnt[i-j+9];
	pw[0]=1;
	for (int i=1;i<=18;++i) pw[i]=10ll*pw[i-1];
	for (int i=1;i<=18;++i) dfs(0,0,1,i);
	printf("%d\n",ans);
	return 0;
}