#include <bits/stdc++.h>
using namespace std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void zz() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
long long dp[51][11];
int32_t main() {
  zz();
  string s;
  cin >> s;
  long long n = s.size();
  vector<long long> v(n);
  for (long long i = 0; i < n; i++) {
    v[i] = s[i] - '0';
  }
  for (long long i = 0; i <= 9; i++) dp[0][i] = 1;
  for (long long i = 0; i < n - 1; i++) {
    for (long long j = 0; j <= 9; j++) {
      long long x = (v[i + 1] + j) / 2;
      long long y = (v[i + 1] + j + 2 - 1) / 2;
      if (x == y) {
        dp[i + 1][x] += dp[i][j];
      } else {
        dp[i + 1][x] += dp[i][j];
        dp[i + 1][y] += dp[i][j];
      }
    }
  }
  long long ans = 0;
  for (long long i = 0; i < 10; i++) {
    ans += dp[n - 1][i];
  }
  ans -= 1;
  for (long long i = 0; i < n - 1; i++) {
    if (v[i] != (v[i] + v[i + 1]) / 2 && v[i] != (v[i] + v[i + 1] + 1) / 2) {
      ans += 1;
      break;
    }
  }
  cout << ans << endl;
}
