#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S, T;
const ll MOD = 998244353;
//const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>S;
    N = S.size();
    ll blue_sum = 0;
    rep(i,N) blue_sum += S[i] - '0';
    mat dp(N*2 + 1, vec(blue_sum + 1, 0));
    //dp[i][b]:今まででb個の青ボールを使う
    dp[0][0] = 1;
    ll b = 0, r = 0; //各々使える最大値
    rep(i,N*2){
        if(i < N) {
            b += S[i] - '0';
            r += '2' - S[i];
        }
        reps(j, max(0LL, (i+1) - r), b + 1){
            dp[i+1][j] = dp[i][j];
            if(j > 0) (dp[i+1][j] += dp[i][j-1])%=MOD;
        }
    }
    cout<<dp[N*2][blue_sum]<<endl;
}