#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
 
const double EPS = 1e-10;
const ll INF = 100000000;
const ll MOD = 998244353;

string str;

ll dp[4010][4010];
ll sum[4010];
ll sum2[4010];

int main() {
    cin >> str;
    ll n = str.size();
    rep(i,n) {
        if (str[i] == '0') sum[i] = 2;
        else if (str[i] == '1') sum[i] = 1;
    }
    for (int i = 1; i < 2*n; i++) sum[i] += sum[i-1];
    rep(i,n) {
        if (str[i] == '2') sum2[i] = 2;
        else if (str[i] == '1') sum2[i] = 1;
    }
    for (int i = 1; i < 2*n; i++) sum2[i] += sum2[i-1];
    dp[0][0] = 1;
    rep(i,2*n) {
        rep(j,2*n+1) {
            if (sum[i] > j) {
                dp[i+1][j+1] = (dp[i+1][j+1]+dp[i][j])%MOD;
            }
            if (sum2[i] > i-j) {
                dp[i+1][j] = (dp[i+1][j]+dp[i][j])%MOD;
            }
        }
    }
    cout << dp[2*n][sum[2*n-1]] << endl;
}

