#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  long long len = 0;
  while (s[len]) {
    len++;
  }
  pair<long long, long long> a[len + 1];
  a[0] = {0, 1};
  a[1] = {0, 1};
  long long i = 1;
  while (s[i]) {
    if (int(s[i] - '0') + int(s[i - 1] - '0') == 9) {
      if (a[i].first == a[i - 1].first + 1) {
        a[i + 1].second = a[i].second + a[i - 1].second;
        a[i + 1].first = a[i].first;
      }
      if (a[i].first < a[i - 1].first + 1) {
        a[i + 1] = {a[i - 1].first + 1, a[i - 1].second};
      }
    } else {
      a[i + 1] = {a[i].first, a[i].second};
    }
    i++;
  }
  cout << a[len].second;
}
