#include <bits/stdc++.h>
using namespace std;
char s[1000000];
const int ati = 2 * '0';
int main() {
  int n = 0;
  for (int i = 0; scanf("%c", s + i) != EOF; i++, n++)
    ;
  char x, y;
  long long cnt = 0;
  long long ans = 1;
  for (int i = 1; i < n; i++) {
    if (s[i - 1] + s[i] - ati == 9) {
      cnt = 1;
      x = s[i - 1];
      y = s[i];
      while (i < n - 2 && x == s[i + 1] && y == s[i + 2]) {
        cnt++;
        i += 2;
      }
      if (i < n - 1 && s[i + 1] == x) {
        cnt++;
        ans *= cnt;
      }
    } else {
      cnt = 0;
      x = '0';
      y = '0';
    }
  }
  cout << ans << endl;
  return 0;
}
