#include using namespace std; using ll = long long; int main() { int a; cin >> a; string S; cin >> S; ll nowz = 0ll, nows = 0ll, ans = 1ll; bool now = true;//0ならtrueだし1ならfalse for (int i = 0; i < a; i++) { if (S[i] == '0') { if (!now&&nowz) { ans *= (nows%998244353ll + 1ll)%998244353ll; ans %= 998244353ll; nowz = 0ll; nows = 0ll; } now = true; nowz++; nows++; } else { now = false; if (nowz) { nows++; } } } if (!now&&nowz) { ans *= (nows%998244353ll + 1ll)%998244353ll; } cout << ans%998244353ll << endl; }