#include <bits/stdc++.h>
using namespace std;
int main() {
  string str;
  bool comb[100005];
  int n;
  while (cin >> str) {
    n = str.length();
    comb[0] = comb[n] = false;
    for (int i = 1; i <= n - 1; i++)
      if (str[i - 1] - '0' + str[i] - '0' == 9)
        comb[i] = true;
      else
        comb[i] = false;
    int start, end;
    unsigned long long ans = 1;
    for (int i = 1; i <= n; i++)
      if (!comb[i - 1] && comb[i])
        start = i;
      else if (comb[i - 1] && !comb[i]) {
        end = i;
        if ((end - start) & 1)
          ans *= 1;
        else
          ans *= (end - start) / 2 + 1;
      }
    cout << ans << endl;
  }
  return 0;
}
