using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static int[] NList => ReadLine().Split().Select(int.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var s = ReadLine(); if (s.All(c => c == '0')) { WriteLine(0); return; } var ans = 1L; var mod = 998_244_353; var prev = -1; for (var i = 0; i < s.Length; ++i) { if (s[i] == '1') { if (prev >= 0) ans = ans * (i - prev + 1) % mod; prev = i; } } WriteLine(ans); } }