#include using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair; using tll=tuple; const ll INF=(1ll<<60); template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> n; vector>> dp(n+1,vector>(26,vector(n+1,0))); dp[0][0][0]=1; rep(i,n){ rep(j,26){ rep(k,i+1){ if(dp[i][j][k]==0) continue; //cout << ('o'-'a') << " " << ('n'-'a') << endl; rep(l,26){ if(k%3==0&&l==('c'-'a')){ dp[i+1][l][k+1]+=dp[i][j][k]; dp[i+1][l][k+1]%=mod; }else if(k%3==1&&l==('o'-'a')){ dp[i+1][l][k+1]+=dp[i][j][k]; dp[i+1][l][k+1]%=mod; }else if(k%3==2&&l==('n'-'a')){ dp[i+1][l][k+1]+=dp[i][j][k]; dp[i+1][l][k+1]%=mod; }else{ dp[i+1][l][k]+=dp[i][j][k]; dp[i+1][l][k]%=mod; } } } } } ll ans=0; rep(j,26){ rep(k,n+1){ ans+=k/3%mod*dp[n][j][k]%mod; ans%=mod; } } cout << ans << endl; }