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