#ifndef INCLUDED_main #define INCLUDED_main #include __FILE__ const ll mod = 998244353; using mint = atcoder::modint998244353; //const ll mod = 1000000007; using mint = atcoder::modint1000000007; int main(){ int n; cin >> n; string s; cin >> s; vector a; rep(i, 0, n){ if(s[i] == '1'){ a.emplace_back(i); } } int as = a.size(); if(as == 0){ cout << 0 << endl; return 0; } if(as == 1){ cout << 1 << endl; return 0; } mint ans = 1; rep(i, 0, as-1){ ans *= a[i+1]-a[i]+1; } cout << ans.val() << endl; } #else #include #include using ll = long long; using ld = long double; using Graph = std::vector>; #define endl '\n' #define INF 1000000039 #define LLINF 393939393939393939 #define fore(i, a) for(auto &i : a) #define rep(i, a, b) for(int i = a; i < b; i++) #define erep(i, a, b) for(int i = a; i <= b; i++) #define rrep(i, a, b) for(int i = a; i >= b; i--) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define part(x, a, b) x.begin()+a, x.begin()+b+1 #define rpart(x, a, b) x.rbegin()+a, x.rbegin()+b+1 #define pcnt(x) __builtin_popcount(x) #define llpcnt(x) __builtin_popcountll(x) template using pq = std::priority_queue; template using pqg = std::priority_queue, std::greater>; template bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; } template bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; } // 多次元配列の生成 template class Mvector : public std::vector>{ public: template Mvector(T init, N n, Sizes... sizes) : std::vector >(n, Mvector(init, sizes...)) { } }; template class Mvector<1, T> : public std::vector{ public: template Mvector(T init, N n) : std::vector(n, init) { } }; using namespace std; #endif