#include <bits/stdc++.h>
using namespace std;
float PHI = 1.6180339;
const float PI_F = 3.14159265358979f;
long long modpow(long long x, long long n, long long m) {
  if (n == 0) return 1 % m;
  long long u = modpow(x, n / 2, m);
  u = (u * u) % m;
  if (n % 2 == 1) u = (u * x) % m;
  return u;
}
long long add(long long x, long long y, long long m) {
  x += y;
  if (x >= m) return x - m;
  return x;
}
long long sub(long long x, long long y) {
  x -= y;
  if (x < 0) return x + 1000000007;
  return x;
}
long long inv(long long a, long long m = 998244353) {
  return modpow(a, m - 2, m);
}
long long mul(long long a, long long b, long long m) {
  return (long long)a * b % m;
}
long long nCrModp(long long n, long long r, long long p) {
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
bool sortinrev(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.first > b.first);
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  cout << fixed << setprecision(12);
  string s;
  cin >> s;
  vector<long long> v;
  long long len = 1;
  for (long long i = 1; i < s.length(); i++) {
    long long x = s[i] - '0';
    long long y = s[i - 1] - '0';
    long long sum = x + y;
    if (sum == 9) {
      ++len;
    } else {
      if (len > 1) v.push_back(len);
      len = 1;
    }
  }
  if (len > 1) v.push_back(len);
  long long ans = 1;
  for (long long i = 0; i < v.size(); i++) {
    if (v[i] % 2 == 1) {
      long long x = (v[i] + 1) / 2;
      ans *= x;
    }
  }
  cout << ans << "\n";
  return 0;
}
