#include <bits/stdc++.h>
long long mod = 1000000007;
using namespace std;
int n;
char a[100005];
int vis[100005];
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
int main() {
  int i, j, fl, test;
  scanf("%s", a);
  int l = strlen(a);
  mod = 1ll;
  int cont = 0;
  for (i = 0; i < l - 1; i++) {
    if (a[i] - '0' + a[i + 1] - '0' == 9) {
      cont += 1;
    } else {
      if (cont % 2 == 0) {
        mod = mod * (cont + 1 - cont / 2);
      }
      cont = 0;
    }
  }
  if (cont % 2 == 0) {
    mod = mod * (cont + 1 - cont / 2);
  }
  printf("%lld\n", mod);
  return 0;
}
