use proconio::input; use proconio::marker::Usize1; use proconio::marker::Chars; fn main() { input! { n: usize, s: Chars, }; let mut dp = vec![vec![0i64; 2]; n + 1]; dp[0][0] = 1; let MOD:i64 = 998244353;; for i in 1..=n { if s[i - 1] == '1' { dp[i][1] = dp[i - 1][0] + dp[i - 1][1]; dp[i][1] += dp[i - 1][1]; dp[i][1] %= MOD; } else { dp[i][0] = dp[i - 1][1] + dp[i - 1][0]; dp[i][1] += dp[i - 1][1]; dp[i][0] %= MOD; } } println!("{}", dp[n][1]); }