const MOD: usize = 998244353; fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let maxcnt = n/3; let mut dp = vec![vec![vec![0usize; 3]; maxcnt+1]; n+1]; dp[0][0][0] = 1; for i in 0..n { for j in 0..=maxcnt { for pat in 0..3 { if dp[i][j][pat] == 0 { continue; } for c in 0..26 { let npat = pat + if (pat == 0 && c == 2) || (pat == 1 && c == 14) || (pat == 2 && c == 13) { 1 } else { 0 }; if npat < 3 { dp[i+1][j][npat] += dp[i][j][pat]; dp[i+1][j][npat] %= MOD; } else { dp[i+1][j+1][0] += dp[i][j][pat]; dp[i+1][j+1][0] %= MOD; } } } } } println!("{}", dp[n].iter().enumerate().map(|(i, v)| v.iter().sum::() % MOD * i % MOD).sum::() % MOD); }