#include <bits/stdc++.h>
using namespace std;
int xx[8] = {-1, -1, -1, 0, 0, 1, 1, 1};
int yy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
const double pi = 3.14159265358;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string s;
  long long cnt, i, ans;
  ans = 1;
  cnt = 0;
  cin >> s;
  for (i = 0; i < s.size(); i++) {
    if (i + 1 < s.size() && (s[i] + s[i + 1] == 2 * '0' + 9))
      cnt++;
    else {
      if (cnt && cnt % 2 == 0) ans *= (cnt / 2) + 1;
      cnt = 0;
    }
  }
  cout << ans;
  return 0;
}
