#include <iostream>
#include <string>

using namespace std;

typedef long long ll;

const ll MOD = 998244353;

ll dp[4001][4001];

int main() {
    string s;
    cin >> s;
    int n = s.length();

    dp[0][0] = 1LL;
    int red = 0, r = 0;
    for(int i=0;i<2*n;++i) {
        if(i < n) {
            r = 2 - int(s[i] - '0');
            red += r;
        }
        for(int j=0;j<=min(i,red);++j) {
            if(j < red) {
                dp[i+1][j+1] += dp[i][j];
            } else {
                dp[i+1][j+1] = 0;
            }
            dp[i+1][j+1] %= MOD;
            if(i-j < min(i+1,n)*2-red) {
                dp[i+1][j] += dp[i][j];
            } else {
                dp[i+1][j] = 0;
            }
            dp[i+1][j] %= MOD;
        }
    }

    cout << dp[2*n][red] << endl;
}