#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/


string D;
//---------------------------------------------------------------------------------------------------
int memo[24][24][2][2];
int f(int L, int R, int Lu, int Ru) {
    int &res = memo[L][R][Lu][Ru];

    if (0 <= res) return res;

    res = 0;

    if (R == 23) {
        if (L == R) res = 0;
        else if(L + 1 == R) {
            rep(a, 1, 10) rep(b, 0, 10) {
                int t = b + D[R] - '0' + Ru;
                int tt = t / 10;
                if (t % 10 != a) continue;
                int s = a + D[L] - '0' + tt;
                if (s % 10 != b) continue;
                if (s / 10 != Lu) continue;
                res++;
                //printf("(%d %d)\n", a, b);
            }
        } else {
            rep(a, 1, 10) rep(b, 0, 10) {
                if ((b + D[R] - '0' + Ru) % 10 != a) continue;
                int Ruu = (b + D[R] - '0' + Ru) / 10;

                if ((a + D[L] - '0') / 10 == Lu && (a + D[L] - '0') % 10 == b) res += f(L + 1, R - 1, 0, Ruu);
                if ((a + D[L] - '0' + 1) / 10 == Lu && (a + D[L] - '0' + 1) % 10 == b) res += f(L + 1, R - 1, 1, Ruu);
            }
        }
    } else {
        if (L == R) {
            rep(a, 0, 10) {
                if ((a + D[L] - '0' + Ru) / 10 != Lu) continue;
                if ((a + D[L] - '0' + Ru) % 10 != a) continue;
                res++;
                //printf("[%d]\n", a);
            }
        } else if (L + 1 == R) {
            rep(a, 0, 10) rep(b, 0, 10) {
                int t = b + D[R] - '0' + Ru;
                int tt = t / 10;
                if (t % 10 != a) continue;
                int s = a + D[L] - '0' + tt;
                if (s % 10 != b) continue;
                if (s / 10 != Lu) continue;
                res++;
                //printf("<%d %d>\n", a, b);
            }
        } else {
            rep(a, 0, 10) rep(b, 0, 10) {
                if ((b + D[R] - '0' + Ru) % 10 != a) continue;
                int Ruu = (b + D[R] - '0' + Ru) / 10;

                if ((a + D[L] - '0') / 10 == Lu && (a + D[L] - '0') % 10 == b) res += f(L + 1, R - 1, 0, Ruu);
                if ((a + D[L] - '0' + 1) / 10 == Lu && (a + D[L] - '0' + 1) % 10 == b) res += f(L + 1, R - 1, 1, Ruu);
            }
        }
    }
    return res;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> D;
    while (D.size() < 24) D = "0" + D;
    rep(L, 0, 24) rep(R, 0, 24) rep(Lu, 0, 2) rep(Ru, 0, 2) memo[L][R][Lu][Ru] = -1;
    //cout << D << endl;
    int L = 0;
    while (D[L] == '0') L++;
    int ans = 0;
    rep(x, 0, L + 1) {
        //printf("{{ %d }}\n", x);
        ans += f(x, 23, 0, 0);
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256