#include <bits/stdc++.h>
using namespace std;
bool comp1(pair<int, int> i, pair<int, int> j) { return (i.first > j.first); }
int main() {
  string input;
  cin >> input;
  int n = input.size();
  vector<int> p;
  for (long long i = 0; i < n; i = i + 1) p.push_back(input[i] - 48);
  int a = 0, b = 0, ps = 0;
  int x = 0, y = 0;
  long long ans = 1, s = 0;
  for (long long i = 0; i < n; i = i + 1) {
    a = p[i];
    if (i + 1 == n)
      b = 0;
    else
      b = p[i + 1];
    if (a + b == 9) {
      if (x == a && y == b) {
        s += 2;
        i++;
        continue;
      }
      if (s == 0) {
        x = a;
        y = b;
        i++;
        s += 2;
        continue;
      }
      i++;
      x = a;
      y = b;
      s = 2;
    }
    if (a + b != 9) {
      if (x == a) {
        s++;
        ans *= (s + 1) / 2;
      }
      s = 0;
    }
  }
  cout << ans;
}
