#include <bits/stdc++.h>
using namespace std;
string s;
long long int n;
vector<long long int> vec;
long long int arr[100100];
long long int con;
long long int doDp() {
  arr[0] = 1;
  arr[1] = 1;
  arr[2] = 1;
  for (long long int i = 3; i <= con; i++) {
    arr[i] = arr[i - 3] + arr[i - 2];
  }
  return arr[con];
}
void getSeq() {
  long long int mark = 0;
  long long int st;
  long long int en;
  for (long long int i = 0; i <= n - 2; i++) {
    long long int a, b;
    a = s[i] - '0';
    b = s[i + 1] - '0';
    if (a + b == 9) {
      if (mark == 0) {
        st = i;
        en = i + 1;
        mark = 1;
      } else {
        en = i + 1;
      }
      if (i == n - 2) {
        vec.push_back(st);
        vec.push_back(en);
      }
    } else {
      if (mark == 1) {
        vec.push_back(st);
        vec.push_back(en);
        mark = 0;
      }
    }
  }
}
long long int cal() {
  getSeq();
  long long int sum = 1;
  int uu;
  for (long long int i = 0; i < vec.size(); i += 2) {
    con = (vec[i + 1] - vec[i]) + 1;
    if (con % 2 == 0)
      uu = 1;
    else
      uu = (con / 2) + 1;
    sum = sum * uu;
  }
  return sum;
}
int main() {
  cin >> s;
  n = s.length();
  cout << cal() << endl;
  return 0;
}
