#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int N; string S; ll mod = 998244353; int main() { cin >> N >> S; vector pos1; for(int i = 0; i < N; ++i) { if(S[i] == '1') pos1.push_back(i); } if(pos1.size() == 0) { cout << 0 << endl; return 0; } ll ans = 1; for(int i = 0; i < pos1.size()-1; ++i) { ans *= pos1[i+1]-pos1[i]+1; ans %= mod; } cout << ans << endl; }