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;
#define X first
#define Y second
#define pb push_back
typedef double db;
typedef long long ll;
typedef pair<int,int> P;
int d;ll res=0;

int main()
{
    scanf("%d",&d);
    if(d%9) return puts("0"),0;
    d/=9;ll t1=0,t2=1;
    for(int i=1;i<=17;i++,t2*=10)
    {
        t1=t1*10+1;
        ll lft=d,cur=t1,lp=t2,rp=1,sum=1;
        
        while(lp>=rp)
        {
            int dgt=(lft%(rp*10))/rp;
            sum*=10-abs(dgt)-(rp==1);
            lft-=cur*dgt;cur-=lp+rp;
            lp/=10;rp*=10;
        }
        if(i%2==0) sum*=10;
        if(!lft) res+=sum;
    }
    printf("%lld",res);
    return 0;
}