#include<cstdio>
#include<cstring>
const long long mod = 998244353;
char s[2001];
long long f[4001][4001];
int sum0[4001]; int sum1[4001];

int main(){
    scanf("%s",s+1);
    int n = strlen(s+1);
    for(int i = 1; i <= n; i++){
        sum0[i] = sum0[i-1], sum1[i] = sum1[i-1];
        if(s[i]=='0') sum0[i] += 2;
        else if(s[i]=='1') sum0[i]++, sum1[i]++;
        else sum1[i] += 2;
    }
    for(int i = n+1; i <= 2*n; i++) sum0[i] = sum0[i-1], sum1[i] = sum1[i-1];
    f[0][0] = 1;
    for(int i = 1; i <= 2*n; i++){
        for(int j = 0; j <= 2*n; j++){
            f[i][j] = 0;
            int cnt0 = j, cnt1 = i-j;
            if(cnt0<=sum0[i] && cnt1<=sum1[i]){
                if(cnt0!=0) f[i][j] = (f[i][j]+f[i-1][j-1])%mod;
                if(cnt1!=0) f[i][j] = (f[i][j]+f[i-1][j])%mod;
            } 
        }
    }
    printf("%lld\n",f[2*n][sum0[2*n]]);
    return 0;
}
