#include <bits/stdc++.h>
using namespace std;
int n, m, dai, dem, vt, ck, chot, tn;
long long kq;
int a[100005], c[200005], b[100005];
char s[100005];
void sol() {
  int i, j;
  dai = strlen(s);
  dem = 0;
  kq = 1;
  j = 0;
  for (i = 0; i < dai; i++) {
    if ((s[i] - '0') + (s[i + 1] - '0') == 9) {
      dem++;
    } else {
      if (dem % 2 == 0) {
        a[j] = dem;
        j++;
      }
      dem = 0;
    }
  }
  for (i = 0; i < j; i++) {
    if (a[i] > 0) kq = kq * (a[i] / 2 + 1);
  }
  cout << kq << endl;
}
int main() {
  int i, j, k, l;
  while (scanf("%s", &s) > 0) {
    sol();
  }
  return 0;
}
