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<algorithm>
#include<vector>
#include<queue>
#include<complex>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;

ll Num9(int k){
  ll a=1;
  for(int i=1;i<k;i++){
    a*=10;
  }
  return a-1;
}

ll Ways(int dis,bool first){
  int a=10-abs(dis);
  if(first&&dis>=0)a--;
  return a;
}

ll ans;
void DFS(int k,ll d,ll cnt,bool first){
  if(k<=1){
    if(k==1&&d==0)ans+=cnt*(ll)10;
    if(k==0&&d==0)ans+=cnt;
    return;
  }
  vector<ll> v;
  ll mo=d%10;if(mo<0)mo+=10;
  if(mo==0)v.push_back(0);
  else{v.push_back(10-mo);v.push_back(0-mo);}
  for(int i=0;i<v.size();i++){
    DFS(k-2,(d-v[i]*Num9(k))/10,cnt*Ways(v[i],first),false);
  }
}
int main(){
  ll d;cin>>d;
  ans=0;
  for(int i=1;i<=18;i++){
    DFS(i,d,1,true);
  }
  cout<<ans<<endl;
  return 0;
}
