#include using namespace std; typedef long long int ll; typedef pair P; typedef vector VI; typedef vector VVI; #define REP(i,n) for(int i=0;i<(n);i++) #define ALL(v) v.begin(),v.end() constexpr ll MOD=1000000007; constexpr ll INF=2e18; int main(){ string s; cin >> s; int n=s.size(); ll dp[10010][2][3][3]={0}; REP(i,n-1) dp[i+1][1][0][0]=1; dp[0][0][0][0]=1; REP(i,n){ REP(j,3)REP(k,3)REP(l,10){ if(l==0) continue; int toj=j, tok=k; if(l==2||l==6) toj=min(2,j+1); else if(l==4||l==8) toj=min(2,j+2); else if(l==5) tok=min(2,k+1); dp[i+1][1][toj][tok]+=dp[i][1][j][k]; if(l