function Main(input) { input = input.split("\n"); const N = Number(input[0]); const A = input[1].trim().split("").map(Number); while (A.length && A.at(-1) == 0) A.pop(); let i = 0; while (i < A.length && A[i] === 1) i++; A.push(0); let ans = 1; let mod = 998244353; let cnt = 1; while (i < A.length - 1) { cnt++; if (A[i] - A[i + 1] > 0) { ans *= cnt; ans %= mod; cnt = 1; } i++; } console.log(ans) } Main(require("fs").readFileSync(0)+"")