#include #include using mint = atcoder::modint998244353; using namespace std; vector> RLE(string A){ int N = A.size(); vector> ret; for (int l = 0; l < N;){ int r = l + 1; while (r < N and A[l] == A[r]){ r++; }; ret.push_back({A[l], r - l}); l = r; } return ret; } int main(){ int N; cin >> N; string S; cin >> S; auto P = RLE(S); mint ans = 1; int M = P.size(); for (int i = 0; i < M; i++){ if (P[i].first == '0'){ if (i != 0 and i != M - 1){ ans *= P[i].second + 2; } } else { ans *= mint(2).pow(P[i].second - 1); } } cout << ans.val() << endl; }