use std::io::{self, Read}; const MOD: u64 = 998244353; fn main() { let mut s = String::new(); io::stdin().read_to_string(&mut s).unwrap(); let mut it = s.split_whitespace(); let n: usize = it.next().unwrap().parse().unwrap(); let a = it.next().unwrap().as_bytes().to_vec(); let mut runs = Vec::<(u8, usize)>::new(); let mut i = 0usize; while i < n { let mut j = i; while j < n && a[j] == a[i] { j += 1; } runs.push((a[i], j - i)); i = j; } let mut ans = 1u64; for i in 0..runs.len().saturating_sub(1) { if runs[i].0 == b'0' && runs[i + 1].0 == b'1' { let x = (runs[i].1 + runs[i + 1].1 + 1) as u64; ans = ans * x % MOD; } } println!("{}", ans); }