#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)

ll dp[11][2][2];
char s[20];

int main(){
	scanf("%s", s);
	int n = strlen(s);
	f(i, 0, n)s[i] -= '0';
	reverse(s, s + n);
	ll an = 0;
	int t = n;
	f(tmp, 0, t + 1){
		f(i, 0, 11)f(j, 0, 2)f(k, 0, 2)dp[i][j][k] = 0;
		dp[0][0][0] = 1;
		f(i, 0, n + 1 >> 1)f(a, 0, 2)f(b, 0, 2)f(k, 0, 10)f(w, 0, 2){
			ll &r = dp[i][a][b];
			int j = n - i - 1;
			if (j == i){
				if (w)continue;
				int z = k + s[i] + a;
				bool c = z >= 10;
				if (c)z -= 10;
				if (z == k && c == b)dp[i + 1][c][c] += r;
			}else {
				int z = k + s[i] + a;
				bool c = z >= 10;
				if (c)z -= 10;
				if (i == 0 && z == 0)continue;
				z += s[j] + w;
				bool d = z >= 10;
				if (d)z -= 10;
				if (z == k && d == b)dp[i + 1][c][w] += r;
			}
		}
		f(i, 0, 2)an += dp[n + 1 >> 1][i][i];
		++n;
	}
	printf("%lld\n", an);
}