#include <bits/stdc++.h>
using namespace std;
vector<unsigned long long> v1, v2;
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string input;
  cin >> input;
  int n = input.length();
  for (int i = 0; i < n - 1; i++) {
    if (input[i] + input[i + 1] - 2 * '0' == 9) v1.push_back(i);
  }
  if (v1.empty()) {
    cout << "1";
    return 0;
  }
  for (int i = 0; i < v1.size() - 1; i++) {
    if (v1[i + 1] - v1[i] == 1) {
      int ct = 1;
      while (v1[i + 1] - v1[i] == 1 && i < v1.size() - 1) {
        ct++;
        i++;
      }
      if (ct % 2 == 0) v2.push_back(ct / 2);
    }
  }
  unsigned long long res = 1;
  if (!v2.empty())
    for (int i = 0; i < v2.size(); i++) {
      res = res * ((v2[i] + 1));
    }
  cout << res;
  return 0;
}
