#include <bits/stdc++.h>
using namespace std;
char s[55];
int len;
long long sol, memo[55][15];
long long rec(int loc, int current) {
  if (loc == len - 1) return 1;
  long long &ret = memo[loc][current];
  if (~ret) return ret;
  ret = 0;
  int diff = current + s[loc + 1] - '0';
  if (diff % 2) ret += rec(loc + 1, diff / 2 + 1);
  ret += rec(loc + 1, diff / 2);
  return ret;
}
int main() {
  memset(memo, -1, sizeof memo);
  scanf("%s", s);
  len = strlen(s);
  for (int i = 0; i <= 9; i++) sol += rec(0, i);
  bool ok = true;
  for (int i = 1; i < len && ok; i++) {
    int curr = s[i] - '0';
    int suma = curr + s[i - 1] - '0';
    if (suma % 2) {
      if (curr != suma / 2 and curr != suma / 2 + 1) ok = false;
    } else if (curr != suma / 2)
      ok = false;
  }
  if (ok) sol--;
  cout << sol << endl;
  return 0;
}
