#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long int len, f;
  cin >> s;
  s += "*";
  len = s.size();
  f = 0;
  vector<long long int> v;
  for (long long int i = 0; i < len - 1; i++) {
    if ((s[i] - '0') + (s[i + 1] - '0') == 9)
      f++;
    else {
      if (f) {
        v.push_back(f);
        f = 0;
      }
    }
  }
  long long int ans = 1;
  for (long long int i = 0; i < v.size(); i++) {
    if (v[i] % 2 == 0) ans *= (v[i] / 2 + 1);
  }
  cout << ans << endl;
  return 0;
}
