#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #define _GLIBCXX_DEBUG #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; #include using mint = atcoder::modint998244353; void operator<<(ostream& os, const mint& m) { os << m.val(); } int main() { int n; string s; cin >> n >> s; vector dp(n + 1, vector(2, 0)); dp[0][0] = 1; rep(i, n) { // 分割しない dp[i + 1][1] = dp[i][1]; // 分割する dp[i + 1][s[i] == '1'] += dp[i][0] + dp[i][1]; Debug(dp[i + 1]); } cout << dp[n][1].val() << endl; return 0; }