
#include <cstdio>
#include <cstring>

using namespace std;
const int Max_L(50);
typedef long long int LL;

int L, len, D[Max_L], N[Max_L], X[Max_L];
char input[Max_L];
LL Ans;

int work(int p, int x)
{
	int Ret(0);
	for (int c = (p == len - 1 ? 1 : 0);c <= 9;++c)
		if (0 <= c - x && c - x <= 9)
			++Ret;
	return Ret;
}

bool check()
{
	for (int i = len - 1, j;i >= 0;--i)
	{
		X[j = i] = N[i];
		while (X[j] < 0)
		{
			if (j == len - 1)
				return false;
			X[j] += 10, --X[++j];
		}
	}
	for (int i = 0;i <= len - 1;++i)
		if (X[i] != D[i])
			return false;
	return true;
}

void dfs(int p, int a, int b, int v, LL Ret = 1LL)
{
	if (!Ret)
		return;
	if (a <= b)
	{
		if (a == b)
			Ret *= work(a, 0);
		if (check())
			Ans += Ret;
		return;
	}
	int x = (D[p] + v) % 10;
	if (x == 0)
		if (D[p] + v == 0)
			N[p] = 0, N[len - 1 - p] = 0, dfs(p + 1, a - 1, b + 1, 0, Ret * work(a, 0));
		else
			N[p] = 0, N[len - 1 - p] = 0, dfs(p + 1, a - 1, b + 1, 1, Ret * work(a, 0));
	else
	{
		N[p] = x, N[len - 1 - p] = -x, dfs(p + 1, a - 1, b + 1, 0, Ret * work(a, x));
		N[p] = x - 10, N[len - 1 - p] = 10 - x, dfs(p + 1, a - 1, b + 1, 1, Ret * work(a, x - 10));
	}
}

int main()
{
	scanf("%s", input), L = strlen(input);
	for (int i = 0;i <= L - 1;++i)
		D[i] = input[L - 1 - i] - '0';
	for (len = L;len <= 19;++len)
		memset(N, 0, sizeof(N)), dfs(0, len - 1, 0, 0);
	printf("%lld", Ans);
	return 0;
}
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <locale>
#include <iostream>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()

using namespace std;

using ll = long long;
using ld = long double;

template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
template <typename T> int len(const T &x) { return x.size(); }

template<typename T>
vector<T> table(int n, T v) { return vector<T>(n, v); }

template <class... Args>
auto table(int n, Args... args) {
  auto val = table(args...);
  return vector<decltype(val)>(n, move(val));
}

struct yes_no : numpunct<char> {
  string_type do_truename()  const { return "YES"; }
  string_type do_falsename() const { return "NO"; }
};

ll tens[32];

ll dp(const int digit, const ll D, bool zero) {
  if (digit == 1) return (D == 0 ? 10 : 0);
  if (digit == 0) return (D == 0 ? 1 : 0);
  if (abs(D) > tens[digit]) return 0;
  ll res = 0;
  for (int diff = -9; diff <= 9; ++diff) {
    int count = 10 - abs(diff) - (zero ? 1 : 0);
    ll nD = D - diff * (tens[digit - 1] - 1);
    if (nD % 10 == 0) res += dp(digit - 2, nD / 10, false) * count;
  }
  return res;
}

void solve(const ll D) {
  tens[0] = 1;
  REP(i,18) tens[i + 1] = tens[i] * 10;
  ll res = 0;
  for (int digit = 1; digit <= 18; ++digit) {
    res += dp(digit, D, true);
  }
  cout << res << endl;
}

int main() {
  locale loc(locale(), new yes_no);
  cout << boolalpha << setprecision(12) << fixed;
  cout.imbue(loc);
	ll D;
	scanf("%lld", &D);
	solve(D);
	return 0;
}
