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