#include <bits/stdc++.h>
using namespace std;
template <typename T>
void mymax(T &_a, T _b) {
  if (_a < _b) _a = _b;
}
template <typename T>
void mymin(T &_a, T _b) {
  if (_a > _b) _a = _b;
}
void print(int _x) { printf("%d ", _x); }
void print(long long _x) { printf("%I64d ", _x); }
string inp;
int n;
long long ans = 0;
long long dp[51][10];
int main() {
  memset(dp, 0, sizeof(dp));
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  cin >> inp;
  n = inp.length();
  for (int i = 0; i < n; i++) inp[i] -= '0';
  for (int i = 0; i <= 9; i++) dp[0][i] = 1;
  for (int i = 1; i < n; i++) {
    int now = inp[i];
    for (int j = 0; j <= 9; j++) {
      int l = (now + j) >> 1, r = (now + j + 1) >> 1;
      dp[i][l] += dp[i - 1][j];
      if (l != r) dp[i][r] += dp[i - 1][j];
    }
  }
  for (int i = 0; i <= 9; i++) ans += dp[n - 1][i];
  bool fg = 1;
  for (int i = 0; i < n - 1; i++)
    if (!(inp[i] - inp[i + 1] <= 1 && inp[i] - inp[i + 1] >= -1)) {
      fg = 0;
      break;
    }
  if (fg) ans--;
  cout << ans << endl;
  return 0;
}
