#include #include #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") using namespace std; using mint = atcoder::modint998244353; int main() { cin.tie(0); cout.tie(0); ios::sync_with_stdio(false); int N; cin >> N; string S; cin >> S; int L = N, R = -1; for(int i = 0; i < N; i++) { if(S[i] == '1') { L = min(L, i); R = max(R, i); } } if(L == N) { cout << 0 << '\n'; } else { int cnt = 2; mint ans = 1; for(int i = L + 1; i <= R; i++) { if(S[i] == '1') { ans *= cnt; cnt = 1; } cnt++; } cout << ans.val() << '\n'; } return 0; }