#include <bits/stdc++.h>
using namespace std;
int main() {
  char str[100000 + 10];
  int head, rear;
  scanf("%s", str);
  head = 0;
  rear = strlen(str) - 1;
  int l = strlen(str);
  long long int ans = 1;
  int cl = 0;
  int cr = 0;
  int flag = 0;
  int ok = 0;
  int len = 0;
  while (head < l - 1) {
    cl = str[head] - '0';
    cr = str[head + 1] - '0';
    if (cl + cr == 9)
      ok = 1;
    else
      ok = 0;
    if (flag) {
      if (ok) {
        len++;
      } else {
        if (len % 2 != 0) ans *= ((len / 2) + 1);
        flag = 0;
        len = 0;
      }
    } else {
      if (ok) {
        flag = 1;
        len = 2;
      }
    }
    head++;
  }
  if (flag) {
    if (len % 2 != 0) ans *= (len / 2) + 1;
  }
  cout << ans << endl;
  return 0;
}
