#include using namespace std; using i64 = long long; const int N = 2e3 + 10, P = 998244353; int n, dp[N], tmp[N]; string s; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n >> s; dp[n] = 1; for(int i = 0; i < n; i ++) { if(s[i] == '0') { for(int j = n, p = 0; j >= 0; j --) { p += dp[j]; dp[j] = ((i64)dp[j] * (n - i - j) + p - dp[j]) % P; p %= P; } }else{ for(int j = 0; j <= n; j ++) dp[j] = dp[j + 1] * (j + 1ll) % P; } } cout << accumulate(dp, dp + n + 1, 0ll) % P; }