#include <bits/stdc++.h>
const int INF = 2000000009;
const int MX = 100005;
const double EPS = 1e-9;
using namespace std;
int main() {
  string s;
  cin >> s;
  int l = s.length();
  long long ans = 1, cnt = 0;
  for (int i = 1; i < l; ++i) {
    if (s[i - 1] - '0' + s[i] - '0' == 9)
      cnt++;
    else {
      if (cnt > 0 && cnt % 2 == 0) ans *= (cnt / 2) + 1;
      cnt = 0;
    }
  }
  if (cnt > 0 && cnt % 2 == 0) ans *= (cnt / 2) + 1;
  cout << ans << "\n";
  return 0;
}
