#include <bits/stdc++.h>
using namespace std;
const long long MX = 1e6;
long long c = 1, ans = 1;
string s;
int main() {
  cin >> s;
  s += "9";
  for (int i = 0; i < (int)s.size(); ++i) {
    if ((s[i] - '0' + s[i + 1] - '0') == 9)
      c++;
    else if (c % 2 && c > 1) {
      ans *= (c + 1) / 2;
      c = 1;
    } else
      c = 1;
  }
  cout << ans;
  return 0;
}
