#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 = 1; i < M - 1; i++){ if (P[i].first == '0'){ ans *= P[i].second + 2; } else { ans *= mint(2).pow(P[i].second - 1); } } cout << ans.val() << endl; }