#include <bits/stdc++.h>
using namespace std;
using db = long double;
using pll = pair<long long, long long>;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t, i, x, j, y, z = 1, k, n;
  string s;
  cin >> s;
  n = s.size();
  if (n > 1) {
    k = 0;
    for (i = 1; i < n; i += 1) {
      long long p = s[i - 1] - '0', c = s[i] - '0';
      if (p + c == 9) {
        if (k == 0)
          k = 2;
        else
          k++;
      } else {
        if (k & 1) z *= (k + 1) / 2;
        k = 0;
      }
    }
    if (k & 1) z *= (k + 1) / 2;
  }
  cout << z << '\n';
}
