#include <bits/stdc++.h>
template <class T>
T _diff(T a, T b) {
  return (a < b ? b - a : a - b);
}
template <class T>
T _abs(T a) {
  return (a < 0 ? -a : a);
}
template <class T>
T _max(T a, T b) {
  return (a > b ? a : b);
}
template <class T>
T _min(T a, T b) {
  return (a < b ? a : b);
}
template <class T>
T max3(T a, T b, T c) {
  return (_max(a, b) > c ? _max(a, b) : c);
}
template <class T>
T min3(T a, T b, T c) {
  return (_min(a, b) < c ? _min(a, b) : c);
}
template <class T>
T GCD(T a, T b) {
  a = _abs(a);
  b = _abs(b);
  T tmp;
  while (a % b) {
    tmp = a % b;
    a = b;
    b = tmp;
  }
  return b;
}
template <class T>
T LCM(T a, T b) {
  a = _abs(a);
  b = _abs(b);
  return (a / GCD(a, b)) * b;
}
template <class T>
T toRad(T deg) {
  return (deg * 2.0 * acos(0.0)) / (180.0);
}
template <class T>
T toDeg(T rad) {
  return (rad * 180.0) / (2.0 * acos(0.0));
}
using namespace std;
string a;
int main() {
  cin >> a;
  int n = a.size();
  long long res = 1;
  int i;
  long long j, l;
  l = 0;
  char c;
  for (i = 0; i < n; i++) {
    if (a[i] == '3' || a[i] == '6') {
      c = a[i];
      j = 0;
      l = 0;
      while (i < n && a[i] == c) {
        if (c == '3') {
          j++;
          c = '6';
        } else {
          l++;
          c = '3';
        }
        i++;
      }
      if (l != j) res *= (max(j, l));
      i--;
    } else if (a[i] == '2' || a[i] == '7') {
      c = a[i];
      j = 0;
      l = 0;
      while (i < n && a[i] == c) {
        if (c == '2') {
          j++;
          c = '7';
        } else {
          l++;
          c = '2';
        }
        i++;
      }
      if (l != j) res *= (max(j, l));
      i--;
    } else if (a[i] == '4' || a[i] == '5') {
      c = a[i];
      j = 0;
      l = 0;
      while (i < n && a[i] == c) {
        if (c == '4') {
          j++;
          c = '5';
        } else {
          l++;
          c = '4';
        }
        i++;
      }
      if (l != j) res *= (max(j, l));
      i--;
    } else if (a[i] == '1' || a[i] == '8') {
      c = a[i];
      j = 0;
      l = 0;
      while (i < n && a[i] == c) {
        if (c == '1') {
          j++;
          c = '8';
        } else {
          l++;
          c = '1';
        }
        i++;
      }
      if (l != j) res *= (max(j, l));
      i--;
    } else
      continue;
  }
  cout << res << endl;
  return 0;
}
