#include <bits/stdc++.h>
using namespace std;
int strToInt(string s) {
  stringstream ss(s);
  int x;
  ss >> x;
  return x;
}
string intToStr(int a) {
  stringstream ss;
  ss << a;
  string str = ss.str();
  return str;
}
int main() {
  string s;
  while (cin >> s) {
    long long int ans = 1;
    for (int i = 0; i < s.length(); i++) {
      long long int cnt = 0;
      while ((s[i] - '0') + (s[i + 1] - '0') == 9 && i + 1 < s.length()) {
        cnt++;
        i++;
      }
      if (cnt % 2 == 0 && cnt) ans *= cnt / 2 + 1;
    }
    cout << max(1LL, ans) << endl;
  }
  return 0;
}
