#include <bits/stdc++.h>
using namespace std;
string s;
int i = 0, x = 0;
long long v = 1;
int main() {
  cin >> s;
  while (i <= s.size()) {
    if (((s[i] - '0') + (s[i + 1] - '0')) == 9) {
      x++;
    } else {
      if (x % 2 == 1) v *= 1;
      if (x % 2 == 0) v *= (x / 2 + 1);
      x = 0;
    }
    i++;
  }
  cout << v;
  return 0;
}
