#include #include using namespace std; using ll = long long; #define rep(i, n) for(int i=0; i>= 1; x *= x; x %= mod; } return res; } int main() { ll n; string a; cin >> n >> a; ll w = 0, b = 0; ll res = 1; ll i = 0; while(i < n) { while(i < n && a[i] == '0') { w++; i++; } while(i < n && a[i] == '1') { b++; i++; } if(w > 0 && b > 0) { res *= (w + b + 1); res %= mod; } cerr << w << " " << b << endl; w = b = 0; } cout << res << endl; // ll m = 0; // rep(i, n-1) { // if(a[i] == '0' && a[i+1] == '1') m++; // } // // n+m C m // vector power(1'000'000, 1); // for(int i=1; i<1'000'000; i++) { // power[i] = power[i-1] * i; // power[i] %= mod; // } // cout << power[n+m] * powm(power[m] * power[n] % mod, mod-2) % mod << endl; }