#include<cstdio>
#include<algorithm>
#include<cstring>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
using namespace std;
const int N=4003,mod=998244353;
int f[N][N]; 
char s[N];
int a[N],b[N];
int main(){
	scanf("%s",s+1);
	int n=strlen(s+1);
	f[0][0]=1;
	rep(i,1,2*n){
		a[i]=a[i-1],b[i]=b[i-1];
		if(s[i]=='0')a[i]+=2;
		if(s[i]=='1')++a[i],++b[i];
		if(s[i]=='2')b[i]+=2;
		rep(j,0,a[i-1]){
			if(i-j<=b[i])
				f[i][j]=(f[i][j]+f[i-1][j])%mod;
			if(j+1<=a[i])
				f[i][j+1]=(f[i][j+1]+f[i-1][j])%mod;
		}
	}
	printf("%d\n",f[n+n][a[n]]);
	return 0;
}