#include <bits/stdc++.h>
using namespace std;
char num[1000005];
int main() {
  scanf("%s", num);
  int len = strlen(num);
  long long res = 1;
  for (int i = 0; i < len - 1;) {
    int j = i + 1;
    while (j < len && num[j - 1] - '0' + num[j] - '0' == 9) {
      ++j;
    }
    int cnt = j - i;
    if (cnt > 1 && cnt % 2 == 1) {
      res *= (cnt + 1) / 2;
    }
    i = j;
  }
  printf("%I64d\n", res);
  return 0;
}
