#include <bits/stdc++.h>
using namespace std;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  int f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
long long egcd(long long a, long long b, long long &x, long long &y) {
  if (a == 0LL) {
    x = 0LL;
    y = 1LL;
    return b;
  }
  long long xx, yy;
  long long val = egcd(b % a, a, xx, yy);
  x = yy - (b / a) * xx;
  y = xx;
  return val;
}
long long gcd(long long a, long long b) {
  while (true) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    long long p = b % a, q = a;
    a = p;
    b = q;
  }
}
long long powerMod(long long x, long long y) {
  long long res = 1;
  x %= 1000000007;
  while (y > 0) {
    if (y & 1) res = (res * x) % 1000000007;
    y = y >> 1;
    x = (x * x) % 1000000007;
  }
  return res % 1000000007;
}
string s;
const long long N = 51;
long long dp[N][10];
long long rec(long long idx, long long last) {
  if (idx == s.length()) {
    return 1;
  }
  if (dp[idx][last] > -1) return dp[idx][last];
  long long sum = last + (s[idx] - 48);
  ;
  long long ans = 0;
  if (sum % 2) {
    ans += rec(idx + 1, sum / 2) + rec(idx + 1, sum / 2 + 1);
  } else {
    ans += rec(idx + 1, sum / 2);
  }
  return dp[idx][last] = ans;
}
void solve() {
  memset((dp), -1, sizeof((dp)));
  long long i, ans = 0;
  cin >> s;
  for (i = 0; i < 10; i++) ans += rec(1, i);
  for (i = 1; s[i]; i++) {
    long long j = s[i] - 48, k = s[i - 1] - 48;
    if ((j + k) / 2 == j || (j + k + 1) / 2 == j)
      ;
    else
      break;
  }
  cout << ans - (i == s.length()) << "\n";
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
