#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=998244353, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;
vector<vector<ll> > dp(5000, vector<ll> (5000, 0));
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll num = 0;
    ll ret = 0, blue = 0;
    string s;
    cin >> s;
    ll n = s.length();
    for(int i=0;i<n;i++){
    	if(s[i] == '1') num++;
    	else if(s[i] == '2') num += 2;
    }
    dp[0][0] = 1;
    for(int i=0;i<n*2;i++){
    	if(i < n){
    		if(s[i] == '0') ret += 2;
    		else if(s[i] == '1') ret++, blue++;
    		else blue += 2;
    	}
    	for(int j=0;j<n*2;j++){
    		if(i-j+1 <= ret)(dp[i+1][j] += dp[i][j]) %= mod;
    		if(j+1 <= blue) (dp[i+1][j+1] += dp[i][j]) %= mod;
    	}
    }
    cout << dp[n*2][num] << endl; 
    return 0;
}
