#include <bits/stdc++.h>
using namespace std;
char a[100002];
long long sum;
long long answ;
int i, j;
int k;
int main() {
  cin >> a;
  k = strlen(a);
  answ = 1;
  for (i = 0; i < k; i++) {
    sum = 1;
    while (a[i] - '0' + a[i + 1] - '0' == 9 && i < k) {
      sum++;
      i++;
    }
    if (sum > 1 && sum % 2 == 1) {
      answ *= (sum / 2 + 1);
    }
  }
  cout << answ << endl;
  return 0;
}
