#include <bits/stdc++.h>
using namespace std;
long long mem[10][50];
long long count(int k, int i, const char* str, int strlen) {
  long long result = 1;
  if (i == strlen) return result;
  if (mem[k][i] >= 0) return mem[k][i];
  result = count((k + str[i] - '0') / 2, i + 1, str, strlen);
  if (((str[i] - '0' + k) & 1) == 1)
    result += count((k + str[i] - '0' + 1) / 2, i + 1, str, strlen);
  return mem[k][i] = result;
}
int checkown(const char* str, int strlen) {
  int prev = str[0];
  for (int i = 1; i < strlen; i++) {
    if (((prev + str[i]) / 2 != str[i]) && ((prev + str[i] + 1) / 2 != str[i]))
      return 0;
    prev = str[i];
  }
  return 1;
}
int main() {
  char mystr[52];
  scanf("%s", mystr);
  int mylen = strlen(mystr);
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < mylen; j++) mem[i][j] = -1;
  long long total = 0;
  for (int i = 0; i < 10; i++) total += count(i, 1, mystr, mylen);
  cout << total - checkown(mystr, mylen) << endl;
  return 0;
}
