#include <bits/stdc++.h>
using namespace std;
unsigned long long int ans = 1;
int main() {
  int i, j, k, l, c = 0, fuck = 0;
  string s;
  cin >> s;
  l = s.size();
  s += "9";
  for (i = 0; i < l; i++) {
    if (fuck == 1) {
      if (int(s[i] - 48) + int(s[i + 1] - 48) == 9)
        c += 1;
      else {
        if (c % 2 != 0) ans *= (c / 2 + 1);
        fuck = 0;
      }
    }
    if (fuck == 0) {
      if (int(s[i] - 48) + int(s[i + 1] - 48) == 9) {
        fuck = 1;
        c = 2;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
