#include <bits/stdc++.h>
using namespace std;
int main() {
  int nr[55];
  string s;
  long long din[55][10];
  cin >> s;
  for (int i = 1; i <= s.length(); ++i) nr[i] = s[i - 1] - '0';
  for (int i = 0; i < 10; ++i) din[1][i] = 1;
  for (int i = 2; i <= s.length(); ++i)
    for (int c = 0; c < 10; ++c) {
      din[i][c] = 0;
      int c1 = 2 * c - nr[i];
      if (c1 >= 0 && c1 < 10) din[i][c] += din[i - 1][c1];
      c1 = 2 * c - nr[i] + 1;
      if (c1 >= 0 && c1 < 10) din[i][c] += din[i - 1][c1];
      c1 = 2 * c - nr[i] - 1;
      if (c1 >= 0 && c1 < 10) din[i][c] += din[i - 1][c1];
    }
  long long ans = 0;
  for (int c = 0; c < 10; ++c) ans += din[s.length()][c];
  bool sw = true;
  for (int i = 1; i < s.length(); ++i) {
    sw = false;
    if ((nr[i] + nr[i + 1]) / 2 == nr[i + 1]) sw = true;
    if ((nr[i] + nr[i + 1] + 1) / 2 == nr[i + 1]) sw = true;
    if (!sw) break;
  }
  if (sw) --ans;
  cout << ans << "\n";
  return 0;
}
