#include <bits/stdc++.h>
using namespace std;
long long dp[51][11];
char old1[100];
long long old2[100];
int main() {
  cin >> old1;
  long long os = strlen(old1);
  for (long long a = 0; a < os; a++) old2[a] = old1[a] - '0';
  for (long long a = 0; a <= 9; a++) dp[0][a] = 1;
  for (long long a = 1; a < os; a++) {
    for (long long b = 0; b <= 9; b++) {
      for (long long c = 1; c >= -1; c--) {
        if (2 * b - old2[a] + c >= 0 && 2 * b - old2[a] + c <= 9) {
          dp[a][b] += dp[a - 1][2 * b - old2[a] + c];
        }
      }
    }
  }
  long long ans = 0;
  for (long long a = 0; a <= 9; a++) {
    ans += dp[os - 1][a];
  }
  long long tp = -1;
  for (long long a = 0; a < os - 1 && tp == -1; a++) {
    if (old2[a] - old2[a + 1] < -1 || old2[a] - old2[a + 1] > 1) {
      tp = 0;
    }
  }
  printf("%lld", ans + tp);
}
