#include <bits/stdc++.h>
using namespace std;
template <typename typ>
void vout(vector<typ>& v) {
  for (int vint = 0; vint < (int)(v).size(); vint++) {
    cout << (v)[vint];
    if (vint == (int)(v).size() - 1)
      cout << endl;
    else
      cout << ' ';
  }
}
template <typename typ>
void arrout(typ* arr, int l) {
  for (int i = 0; i < l; i++) {
    cout << arr[i];
    if (i < l - 1)
      cout << ' ';
    else
      cout << endl;
  }
}
struct debugger {
  template <typename T>
  debugger& operator,(const T& v) {
    cerr << v << " ";
    return *this;
  }
} dbg;
int main() {
  string s;
  long long ans = 1;
  cin >> s;
  int c = 0;
  for (int i = 1; i < (int)(s).size(); ++i) {
    if (s[i] - '0' + s[i - 1] - '0' == 9)
      ++c;
    else if (c > 0) {
      if (c % 2 == 0) ans *= c / 2 + 1;
      c = 0;
    }
  }
  if (c > 0 && c % 2 == 0) ans *= c / 2 + 1;
  cout << (ans) << endl;
}
