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<bits/stdc++.h>
using namespace std;
using Int = long long;

vector<Int> po(20,1);

Int dfs(Int k,Int n,Int d){
  if(k==n/2) return !d;
  Int u=po[n-(k+1)]-po[k];
  Int x=d>=0?(d+u-1)/u:d/u;
  Int res=0;
  for(Int i=0;i<2;i++,x--){
    if(x<-9||x>9) continue;
    Int v=0;
    for(Int j=(k==0);j<10;j++) v+=(0<=x+j&&x+j<10);
    res+=dfs(k+1,n,d-x*u)*v;
  }
  return res;
};

//INSERT ABOVE HERE
signed main(){
  Int d;
  cin>>d;
  for(Int i=0;i<18;i++) po[i+1]=po[i]*10;
  Int ans=0;
  for(Int i=1;i<18;i++) ans+=(i&1?1:10)*dfs(0,i+1,d);
  cout<<ans<<endl;
  return 0;
}
