#include <bits/stdc++.h>
char line[10000];
int main() {
  gets(line);
  int H[100];
  int L = strlen(line);
  for (int i = 0; i < L; ++i) H[i] = line[i] - '0';
  long long F[100][10], G[100][10];
  memset(F, 0, sizeof(F));
  memset(G, 0, sizeof(G));
  for (int i = 0; i < L; ++i)
    if (!i) {
      for (int j = 0; j < 10; ++j) F[i][j] = 1;
      G[i][H[i]] = 1;
    } else {
      for (int j = 0; j < 10; ++j)
        for (int k = 0; k <= ((j + H[i]) & 1); ++k)
          F[i][((j + H[i]) / 2) + k] += F[i - 1][j];
      for (int k = 0; k <= (H[i - 1] + H[i]) % 2; ++k)
        if ((H[i - 1] + H[i]) / 2 + k == H[i]) G[i][H[i]] += G[i - 1][H[i - 1]];
    }
  long long res = 0;
  for (int i = 0; i < 10; ++i) res += F[L - 1][i];
  res -= G[L - 1][H[L - 1]];
  printf("%I64d\n", res);
  return 0;
}
