// 意外的过了(>_<)
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cmath>
#include<set>
#define maxn 1000010
#define LL long long
using namespace std;
char a[maxn] ;
LL ans[maxn/3], ff[220];
int main()
{
int n , m , i , j ;
int tt ,len ;
LL hh ;
// freopen("in.txt","r",stdin) ;
while( scanf("%s" , a ) != EOF )
{
n = strlen(a) ;
tt = 1 ;
len = 0 ;
a[n] = 'y' ;
a[n+1] = ' ' ;
for( i = 1 ; i <= n ;i++ )
{
if( (int)a[i]+a[i-1]-'0'-'0'== 9 )tt++ ;
else
{
//tt = (tt&1)+tt/2 ;
// cout << tt << " " ;
if((tt&1) && tt >= 3) ans[len++] = tt/2+1 ;
tt = 1 ;
}
}
hh = 1 ;
for( i = 0 ; i < len ;i++ )
hh *= ans[i] ;
cout << hh << endl ;
}
return 0 ;
}