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;

typedef long long ll;
ll n, ans;

int main() {
    scanf("%lld", &n);
    if (n % 9) printf("0\n"), exit(0);
    n /= 9;
    ll cur = 0, curpw = 1;
    for (int i = 1; i <= 17; i++) {
        cur = cur * 10 + 1;
        ll tmp = 1, m = n, pw = 1, base = cur;
        for (int j = 0; j + j <= i; j++) {
            tmp *= 10 - abs(m % (pw * 10) / pw) - !j;
            m -= base * (m % (pw * 10) / pw);
            base -= curpw / pw + pw, pw *= 10;
        }
        if (!m) ans += tmp;
        curpw *= 10;
    }
    printf("%lld\n", ans);
    return 0;
}