#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  cin >> str;
  int n = str.size();
  long long ans = 1;
  for (int i = 1; i < str.size(); i++) {
    if ((str[i] - '0') + (str[i - 1] - '0') == 9) {
      int len = 2;
      int j = i + 1;
      while (j < n && (str[j] - '0') + (str[j - 1] - '0') == 9) {
        j++;
        len++;
      }
      if (len % 2) ans = (ans * (long long)ceil(1.0 * len / 2));
      i = j - 1;
    }
  }
  cout << ans << endl;
  return 0;
}
