#include <bits/stdc++.h>

using namespace std;

const int max_n = 2022, mod = 998244353;

int n, dp[2 * max_n][2 * max_n], cnt[2][max_n];
string s;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> s;
    n = s.length();
    for (int i = 0; i < n; ++i) {
        cnt[0][i] = s[i] - '0';
        cnt[1][i] = 2 - cnt[0][i];
        if (i) {
            cnt[0][i] += cnt[0][i - 1];
            cnt[1][i] += cnt[1][i - 1];
        }
    }
    cnt[0][n] = cnt[0][n - 1];
    cnt[1][n] = cnt[1][n - 1];
    dp[0][0] = 1;
    for (int i = 0; i < 2 * n; ++i) {
        for (int j = 0; j <= i; ++j) {
            if (!dp[i][j]) {
                continue;
            }
            if (j + 1 <= cnt[0][min(i, n - 1)]) {
                dp[i + 1][j + 1] += dp[i][j];
                dp[i + 1][j + 1] %= mod;
            }
            if (i - j + 1 <= cnt[1][min(i, n - 1)]) {
                dp[i + 1][j] += dp[i][j];
                dp[i + 1][j] %= mod;
            }
        }
    }
    printf("%d\n", dp[2 * n][cnt[0][n - 1]]);
    return 0;
}
