#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int l = s.length();
  int count1 = 0;
  long long ans = 1;
  for (int i = 0; i < l; i++) {
    if ((s[i] - '0' + s[i + 1] - '0') == 9)
      count1++;
    else {
      if (count1 == 0) continue;
      if (count1 % 2 != 0) {
        count1 = 0;
        continue;
      } else if (count1 % 2 == 0) {
        ans *= (long long)(count1 / 2 + 1);
        count1 = 0;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
