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<cstring>
#include<cstdio>
#include<algorithm>

#define fo(i,a,b) for(int i=a;i<=b;i++)

typedef long long LL;
	
using namespace std;

LL mi10[20];
LL a[10];
int l;
int cnt;

void dfs(int x,LL d,int c){
	if (x>l){
		if (d==0)cnt+=c;
		return;
	}
	if (d>=1ll*a[x]*10||d<=-1ll*a[x]*10)return;
	fo(i,1,9){
		if (x==1)dfs(x+1,d-1ll*i*a[x],c*(9-i));
		else dfs(x+1,d-1ll*i*a[x],c*(10-i));
	}
	if (x==1)dfs(x+1,d,c*9);
	else dfs(x+1,d,c*10);
	fo(i,-9,-1){
		if (x==1)dfs(x+1,d-1ll*i*a[x],c*(9+i));
		else dfs(x+1,d-1ll*i*a[x],c*(10+i));
	}
}

int main(){
	mi10[0]=1;
	fo(i,1,18)mi10[i]=mi10[i-1]*10;
	int d;
	scanf("%d",&d);
	int ans=0;
	for(int len=2;len<=18;len++){
		for(int i=1;i<=len/2;i++)a[i]=mi10[len-i]-mi10[i-1];
		l=len/2;
		cnt=0;
		dfs(1,d,1);
		if (len&1)cnt=cnt*10;
		ans=ans+cnt;
	}
	printf("%d\n",ans);
	return 0;
}