#include <bits/stdc++.h>
using namespace std;
static const double EPS = 1e-12;
vector<int> w;
long long mem[51][10];
bool can(void) {
  for (int i = (1); i < ((int)w.size()); ++i) {
    int a = (w[i] + w[i - 1]) / 2;
    int b = (w[i] + w[i - 1] + 1) / 2;
    if (a != w[i] && b != w[i]) return false;
  }
  return true;
}
long long solve(int cur, int digit) {
  if (cur == (int)w.size() - 1) return 1LL;
  long long &ret = mem[cur][digit];
  if (ret < 0LL) {
    ret = 0LL;
    int a = (w[cur + 1] + digit) / 2;
    int b = (w[cur + 1] + digit + 1) / 2;
    ret += solve(cur + 1, a);
    if (b != a) ret += solve(cur + 1, b);
  }
  return ret;
}
int main(void) {
  string s;
  cin >> s;
  for (int i = 0; i < (int)(s.size()); ++i) w.push_back((int)(s[i] - '0'));
  for (int i = 0; i < (51); ++i)
    for (int j = 0; j < (10); ++j) mem[i][j] = -1LL;
  long long ans = 0;
  for (int i = 0; i < (10); ++i) ans += solve(0, i);
  if (can()) --ans;
  cout << ans << endl;
  return 0;
}
