#include using namespace std; using ll = long long; ll const m = 998244353; int main () { int N; cin >> N; ll ans = 1; ll pre = -1; for (int i = 0; i < N; i ++) { char c; cin >> c; if (c == '1') { if (pre >= 0) { ans = (ans * (i - pre + 1)) % m; } pre = i; } } cout << ans << endl; }