#include using namespace std; #define rep(i, a, b) for (int i = (int)(a); i < (int)(b); i++) #define rrep(i, a, b) for (int i = (int)(a); i > (int)(b); i--) #define ll long long #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define PQ priority_queue, greater> #define PQ_g priority_queue, vector>, greater>> #define chmin(a, b) a = min(a, b) #define chmax(a, b) a = max(a, b) const int d4[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}}; const int d8[8][2] = {{0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}, {-1, -1}, {-1, 0}, {-1, 1}}; void Yes(bool b) {cout << (b ? "Yes" : "No") << endl;} int main() { int n; cin >> n; string a; cin >> a; ll const MOD = 998244353LL; a = '1' + a + '0'; ll ans = 1LL; ll cnt = 1; bool flg0 = false, flg1 = false; vector bound10; rep(i, 0, a.size() - 1) { if (a[i] == '1' && a[i + 1] == '0') bound10.push_back((ll)i); } rep(i, 0, bound10.size() - 1) { ans *= bound10[i + 1] - bound10[i] + 1LL; ans %= MOD; } cout << ans << endl; }