#include <bits/stdc++.h>
using namespace std;
int i, j, k, n, m, s;
long long int ans = 1;
string x, y;
int main() {
  cin >> x;
  k = 1;
  i = 1;
  while (x[i] != '\0') {
    if (x[i] - '0' + x[i - 1] - '0' == 9)
      k++;
    else if (k % 2 == 1) {
      ans *= (k / 2 + 1);
      k = 1;
    } else
      k = 1;
    i++;
  }
  if (k % 2 == 1) ans *= (k / 2 + 1);
  cout << ans;
}
