#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long length, i, state = 0, cur, j, ans = 0, prev;
  cin >> s;
  length = s.size();
  long long ara1[10], ara2[10];
  for (i = 0; i < 10; i++) ara1[i] = 1;
  memset(ara2, 0, sizeof ara2);
  for (i = 1; i < length; i++) {
    cur = s[i] - '0';
    if (state == 0) {
      for (j = 0; j < 10; j++) {
        if ((j + cur) % 2 == 0) {
          ara2[(j + cur) / 2] += ara1[j];
        } else {
          ara2[(j + cur - 1) / 2] += ara1[j];
          ara2[(j + cur + 1) / 2] += ara1[j];
        }
      }
      state = 1;
      memset(ara1, 0, sizeof ara1);
    } else {
      for (j = 0; j < 10; j++) {
        if ((j + cur) % 2 == 0) {
          ara1[(j + cur) / 2] += ara2[j];
        } else {
          ara1[(j + cur - 1) / 2] += ara2[j];
          ara1[(j + cur + 1) / 2] += ara2[j];
        }
      }
      state = 0;
      memset(ara2, 0, sizeof ara2);
    }
  }
  if (state == 0) {
    for (i = 0; i < 10; i++) ans += ara1[i];
  } else {
    for (i = 0; i < 10; i++) ans += ara2[i];
  }
  for (i = 1; i < length; i++) {
    cur = s[i] - '0';
    prev = s[i - 1] - '0';
    if ((cur + prev) % 2 == 0) {
      if ((cur + prev) / 2 != cur) break;
    } else {
      if ((cur + prev - 1) / 2 != cur && (cur + prev + 1) / 2 != cur) break;
    }
  }
  if (i == length) ans -= 1;
  cout << ans;
  return 0;
}
