#include using namespace std; #define rep(i, n) for(int i=0; i #include int main() { int N; string S; cin >> N >> S; vector dp(N + 1, 0); ll c = 0; rep(i, N) { if (S[i] == '0') { c++; dp[i + 1] += dp[i]; } if (S[i] == '1') { if (dp[i] == 0) { dp[i + 1] = 1; } else { dp[i + 1] += dp[i] * (c + 2); } c = 0; } dp[i + 1] %= mod; } cout << dp[N] << endl; }