#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  solve();
  return 0;
}
template <typename T>
void sc(T& x) {
  cin >> x;
}
template <typename Head, typename... Tail>
void sc(Head& head, Tail&... tail) {
  cin >> head;
  sc(tail...);
}
template <typename T>
void pr(const T& x) {
  cout << x << '\n';
}
template <typename Head, typename... Tail>
void pr(const Head& head, const Tail&... tail) {
  cout << head << ' ';
  pr(tail...);
}
void solve() {
  string s;
  sc(s);
  vector<int> v;
  for (int i = 0; i < ((int)s.size()); i++) {
    v.push_back(s[i] - '0');
  }
  int i = 0, n = ((int)v.size());
  long long ans = 1;
  while (i < n - 1) {
    if (v[i] + v[i + 1] == 9) {
      int sz = 2;
      int j = i + 1;
      while (j < n - 1 && v[j] + v[j + 1] == 9) {
        sz++;
        j++;
      }
      if (sz & 1) {
        sz -= 3;
        ans *= 2 + sz / 2;
      }
      i = j;
      continue;
    }
    i++;
  }
  pr(ans);
}
