#include <bits/stdc++.h>
using namespace std;
long long X[1048576 + 5];
int main() {
  string input;
  cin >> input;
  int mode = 0;
  long long ans = 1;
  for (int i = 0; i < input.size() - 1; i++) {
    if (input[i] - '0' + input[i + 1] - '0' == 9)
      mode++;
    else {
      if (mode % 2 == 0 && mode > 0) ans *= mode / 2 + 1;
      mode = 0;
    }
  }
  if (mode % 2 == 0 && mode > 0) ans *= mode / 2 + 1;
  cout << ans;
  return 0;
}
