#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  s += 'x';
  long long sum = 1;
  long long count = 1;
  string tmp = "";
  tmp += s[0];
  for (int i = 1; i < s.length(); ++i) {
    if (((s[i] - '0') + (s[i - 1] - '0')) == 9) {
      tmp += s[i];
      ++count;
    } else {
      if (count > 1 && count % 2 != 0) {
        long long ind = (count / 2 + 1);
        sum *= ind;
      }
      tmp = s[i];
      count = 1;
    }
  }
  cout << sum << endl;
}
