#include <bits/stdc++.h>
const double pi = acos(-1.0);
using namespace std;
int h[512345];
int main() {
  string s;
  getline(cin, s);
  for (int i = 0; i < s.size(); ++i) {
    if (i != 0 && int(s[i] - '0') + int(s[i - 1] - '0') == 9)
      h[i] += h[i - 1] + 1;
    else
      h[i] = 0;
  }
  long long ans = 1;
  for (int i = 1; i <= s.size(); ++i)
    if (h[i] == 0 && h[i - 1] > 0 && h[i - 1] % 2 == 0)
      ans *= (h[i - 1] / 2 + 1);
  printf("%I64d", ans);
  return 0;
}
