#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<int,int> P;
const LL mod=998244353;
const LL LINF=1LL<<62;
const LL INF=1<<17;



int main(){
    string s;cin >> s;
    int N=s.length();
    vector<int> a,b;
    for (int i = 0; i < N; i++) {
        if(s[i]=='0'){
            a.pb(i);
            a.pb(i);
        }
        else if(s[i]=='1'){
            a.pb(i);
            b.pb(i);
        }
        else{
            b.pb(i);
            b.pb(i);
        }
    }
    vector<vector<LL>> dp(2*N+1,vector<LL>(2*N+1,0));
    dp[0][0]=1;
    for (int i = 0; i < 2*N; i++) {
        for (int j = 0; j < 2*N; j++) {
            int k=i+j;
            if(i<a.size()&&a[i]<=k) dp[i+1][j]=(dp[i+1][j]+dp[i][j])%mod;
            if(j<b.size()&&b[j]<=k) dp[i][j+1]=(dp[i][j+1]+dp[i][j])%mod;

        }
    }
    cout << dp[a.size()][b.size()] << endl;
    return 0;
}

