#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  ;
  string s;
  cin >> s;
  long long n = s.size();
  long long a[n];
  for (long long i = 0; i < n; ++i) a[i] = (long long)(s[i] - '0');
  long long ans = 0;
  bool minus = true;
  for (long long i = 1; i < n; ++i) {
    long long sum = a[i] + a[i - 1];
    if (sum & 1) {
      if (sum / 2 == a[i] || (sum + 1) / 2 == a[i]) {
      } else
        minus = false;
    } else {
      if (sum / 2 != a[i]) minus = false;
    }
  }
  for (long long c = 0; c <= 9; ++c) {
    long long dp[n][10];
    for (long long i = 0; i < n; ++i) {
      for (long long j = 0; j < 10; ++j) dp[i][j] = 0;
    }
    dp[0][c] = 1;
    for (long long i = 1; i < n; ++i) {
      for (long long prev = 0; prev < 10; ++prev) {
        long long sum = prev + a[i];
        if (sum & 1) {
          dp[i][sum / 2] += dp[i - 1][prev];
          dp[i][(sum + 1) / 2] += dp[i - 1][prev];
        } else {
          dp[i][sum / 2] += dp[i - 1][prev];
        }
      }
    }
    for (long long i = 0; i < 10; ++i) ans += dp[n - 1][i];
  }
  cout << ans - minus;
}
