#include <bits/stdc++.h>
using namespace std;
char x[1000005];
int n;
long long ans = 1;
int cur = 0;
int main() {
  gets(x);
  n = strlen(x);
  for (int i = 0; i < n; i++) {
    if (i + 1 < n && (x[i] - '0' + x[i + 1] - '0' == 9)) {
      while (i + 1 < n && (x[i] - '0' + x[i + 1] - '0' == 9)) {
        i++;
        cur++;
      }
    }
    if (cur != 0 && cur % 2 == 0) ans *= (cur / 2 + 1);
    cur = 0;
  }
  cout << ans << endl;
  return 0;
}
