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 <cstring>
using namespace std;
typedef long long LL;

LL Count(int l, int r, LL d) {
    if (l >= r) return (d == 0) ? (l == r ? 10 : 1) : 0;
    if (d % 10 == 0) return (l == 1 ? 9 : 10) * Count(l + 1, r - 1, d / 10);
    LL diff = d % 10 - 10;
    LL powe = 1;
    for (int i = 1; i <= r - l; ++i) powe *= 10;
    LL nd = d - diff + diff * powe;
    return ((l == 1 ? 9 : 10) + diff) * Count(l + 1, r - 1, abs(nd) / 10);
}

int main() {
    int d;
    cin >> d;
    LL ans = 0;
    for (int len = 2; len <= 18; ++len) ans += Count(1, len, d);
    cout << ans;
    return 0;
}