#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
int D;
int N=17;
ll ans,a,b=1;
int main()
{
    cin>>D;
    if(D%9)
    {
        puts("0");
        return 0;
    }
    D/=9;
    for(int i=1;i<=N;i++)
    {
        ll res=1,temp=D,all=a*10+1,l=b,r=1;
        for(int j=0;j<=i/2;j++)
        {
            ll tmp=temp%(r*10)/r;            
            ll x=10-abs(tmp);
            if(!j)  x--;
            res*=x;
            temp-=all*tmp;
            all-=l+r;
            l/=10;r*=10;
        }
        b*=10;a=a*10+1;
        if(!temp)
        {
            ans+=res;
        }
    }
    printf("%lld\n",ans);
    return 0;
}
### Prompt

Please create a solution in Cpp to the following problem:

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

### Response

```cpp
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
typedef long long ll;
int D;
int N=17;
ll ans,a,b=1;
int main()
{
    cin>>D;
    if(D%9)
    {
        puts("0");
        return 0;
    }
    D/=9;
    for(int i=1;i<=N;i++)
    {
        ll res=1,temp=D,all=a*10+1,l=b,r=1;
        for(int j=0;j<=i/2;j++)
        {
            ll tmp=temp%(r*10)/r;            
            ll x=10-abs(tmp);
            if(!j)  x--;
            res*=x;
            temp-=all*tmp;
            all-=l+r;
            l/=10;r*=10;
        }
        b*=10;a=a*10+1;
        if(!temp)
        {
            ans+=res;
        }
    }
    printf("%lld\n",ans);
    return 0;
}
```