#include using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,a,b) for (int i=a; i=b; i--) #define fore(i,a) for(auto &i:a) #define pb push_back #define _GLIBCXX_DEBUG template inline bool chmin(T& a, const T& b) {bool c=a>b; if(a>b) a=b; return c;} template inline bool chmax(T& a, const T& b) {bool c=a inline T gcd(T a,T b) {return (b==0)?a:gcd(b,a%b);} template inline T lcm(T a, T b) {return (a*b)/gcd(a,b);} const int inf = INT_MAX / 2; const ll infl = 1LL << 60; using vi = vector; using vvi = vector>; using vvvi = vector>>; using vll = vector; using vvll = vector>; using vvvll = vector>>; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; ll MOD = 998244353; cin >> n; string a; cin >> a; char bef; bool init = false; int cnt = 0; ll ans = 1; rep(i,0,n){ if(!init){ if(a.at(i) == '0'){ init = true; cnt = 2; bef = '0'; } } else{ if(bef == '1' and a.at(i) == '0'){ ans *= cnt; ans %= MOD; cnt = 2; bef = '0'; } else if(a.at(i) == '1' and i == n-1){ ans *= cnt+1; ans %= MOD; } else{ cnt ++; bef = a.at(i); } } } cout << ans << endl; cout << fixed << setprecision(30); return 0; }