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