#include <bits/stdc++.h>
using namespace std;
long long getNum(long long p) {
  if (p % 2 == 1)
    return 1;
  else
    return (p / 2) + 1;
}
int main() {
  string s;
  cin >> s;
  vector<int> arr;
  vector<long long> res;
  for (long long i = 0; i < s.size(); i++) arr.push_back(s[i] - '0');
  long long count = 0;
  for (long long i = 0; i < arr.size() - 1; i++) {
    if ((arr[i] + arr[i + 1]) == 9)
      count++;
    else {
      if (count > 0) res.push_back(getNum(count));
      count = 0;
    }
  }
  if (count > 0) res.push_back(getNum(count));
  long long t = 1;
  for (long long i = 0; i < res.size(); i++) t *= res[i];
  cout << t << endl;
  return 0;
}
