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 <vector>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cmath>

using namespace std;

const int MAX_DIGIT = 18;

long long check(int digits, long long d, bool first)
{
	if (digits == 0) return (d == 0 ? 1 : 0);
	if (digits == 1) return (d == 0 ? 10 : 0);
	if (abs(d) >= stoll(string(digits, '9'))) return 0;

	long long coe = stoll(string(digits - 1, '9'));

	long long ans = 0;

	for (long long cur = -9; cur <= 9; ++cur) {
        long long newD = d - cur * coe;
        if (newD % 10) continue;

        if (first) {
            if (cur >= 0) ans += check(digits - 2, newD / 10, 0) * (9 - cur);
        } else {
            ans += check(digits - 2, newD / 10, 0) * (10 - abs(cur));
        }
	}

    return ans;
}

int main()
{
    int d;
    cin >> d;
    long long ans = 0;
    for (int i = 1; i <= MAX_DIGIT; ++i) {
        ans += check(i, d, 1);
//        cerr << check(i, d, 1) << endl;
    }
    cout << ans << endl;
}
