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