#include <bits/stdc++.h>
using namespace std;
char a[111111];
long long f[111111][2], g[111111][2];
int n;
int main() {
  scanf("%s", a + 1);
  n = strlen(a + 1);
  g[0][0] = 1;
  a[++n] = '9';
  for (int i = 1; i <= n; ++i) {
    f[i][0] = f[i - 1][0];
    g[i][0] = g[i - 1][0];
    if (f[i - 1][1] > f[i][0])
      f[i][0] = f[i - 1][1], g[i][0] = g[i - 1][1];
    else if (f[i - 1][1] == f[i][0])
      g[i][0] += g[i - 1][1];
    if (((a[i]) - '0') == 9)
      f[i][0]++;
    else {
      if (i > 1 && ((a[i]) - '0') + ((a[i - 1]) - '0') == 9)
        f[i][1] = f[i - 1][0] + 1, g[i][1] = g[i - 1][0];
    }
  }
  cout << g[n][0] << endl;
}
