#include using namespace std; static const long long MOD = 998244353LL; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; string A; cin >> N >> A; long long ans = 1; int i = 0; while (i < N) { int j = i; // "10" が現れる直前までを1区間とする while (j + 1 < N && !(A[j] == '1' && A[j + 1] == '0')) { j++; } int len = j - i + 1; bool has0 = false, has1 = false; for (int k = i; k <= j; k++) { if (A[k] == '0') has0 = true; else has1 = true; } if (has0 && has1) { ans = ans * (len + 1) % MOD; } i = j + 1; } cout << ans % MOD << '\n'; return 0; }