#include <bits/stdc++.h>
using namespace std;
long long sum;
long long f[100][100];
int a[51], i, j;
char s[51];
void mahoa() {
  for (i = 0; i < strlen(s); i++) a[i] = s[i] - '0';
}
void khoitao() {
  for (i = 0; i <= 9; i++) f[strlen(s)][i] = 1;
  sum = 0;
}
bool kiemtra(int x) {
  bool kt = true;
  for (i = 0; i < x - 1; i++)
    if ((a[i] + a[i + 1]) % 2 == 0) {
      if ((a[i] + a[i + 1]) / 2 != a[i + 1]) {
        kt = false;
        break;
      }
    } else {
      if ((a[i] + a[i + 1]) / 2 != a[i + 1] &&
          (a[i] + a[i + 1]) / 2 + 1 != a[i + 1]) {
        kt = false;
        break;
      }
    }
  return kt;
}
void ham() {
  for (i = strlen(s) - 1; i >= 1; i--)
    for (j = 0; j <= 9; j++)
      if ((j + a[i]) % 2 == 0)
        f[i][j] = f[i + 1][(j + a[i]) / 2];
      else
        f[i][j] = f[i + 1][(j + a[i]) / 2] + f[i + 1][(a[i] + j) / 2 + 1];
  for (i = 0; i <= 9; i++) sum += f[1][i];
  cout << sum - kiemtra(strlen(s)) << '\n';
}
int main() {
  cin >> s;
  mahoa();
  khoitao();
  ham();
}
