#include using namespace std; using ll = long long; const int N = 2010, mod = 998244353; int n; ll dp[N][N]; string s; int main() { ios::sync_with_stdio(0), cin.tie(0); cin >> n >> s, s = ' ' + s; dp[0][n] = 1; for (int i = 1; i <= n; i++) { for (int j = 0; j <= n; j++) { if (s[i] == '0') { (dp[i][j] += dp[i - 1][j] * (n - i + 1 - j) % mod) %= mod; for (int k = 0; k < j; k++) { (dp[i][k] += dp[i - 1][j]) %= mod; } } else { if (j) (dp[i][j - 1] += dp[i - 1][j] * j % mod) %= mod; } } } cout << dp[n][0]; return 0; } ////