#include <bits/stdc++.h>
char word[100005];
int main() {
  while (~scanf("%s", word)) {
    int len = strlen(word);
    long long sum = 1;
    long long num = 1;
    for (int i = 1; i < len; i++) {
      if ((word[i] - '0') + (word[i - 1] - '0') == 9) {
        num++;
      } else {
        if (num > 1) {
          if (num % 2 == 1) {
            sum *= ((num / 2) + 1);
            num = 1;
          } else {
            num = 1;
          }
        }
      }
    }
    if (num > 1 && num % 2 == 1)
      printf("%I64d\n", sum * (num / 2 + 1));
    else
      printf("%I64d\n", sum);
  }
  return 0;
}
