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