// {{{
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdint>
#include <cstdio>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <tuple>
#include <utility>
#include <vector>
using namespace std;
// }}}

using ll = long long;

ll MOD = 998244353;

string S;

int thres[2][2020], N, R, B;
ll dp[4040][4040];

int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    cin >> S;
    N = S.size();

    for (int i = 1; i <= N; ++i) {
        thres[0][i] = thres[0][i-1] + 2 - (S[i-1] - '0');
        thres[1][i] = thres[1][i-1] + (S[i-1] - '0');
    }
    R = thres[0][N]; B = thres[1][N];

    dp[0][0] = 1;
    for (int w = 1; w <= 2*N; ++w) {
        int rM = w <= N ? thres[0][w] : R;
        for (int r = 0; r <= rM; ++r) {
            int b = w - r;
            if (b > (w <= N ? thres[1][w] : B)) continue;
            if (r > 0) (dp[r][b] += dp[r-1][b]) %= MOD;
            if (b > 0) (dp[r][b] += dp[r][b-1]) %= MOD;
        }
    }

    cout << dp[R][B] << endl;

    return 0;
}
