#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mk make_pair
#define rint register int
using namespace std;
const int mod = 998244353;
inline int read(){int w=1,s=0;char ch=getchar();while(!isdigit(ch)){if(ch=='-')w=-1;ch=getchar();}while(isdigit(ch)){s=s*10+ch-'0';ch=getchar();}return w*s;}
int f[4020][4020];
int n;
char s[100010];
inline int add(int a,int b){a+=b;if(a>=mod) a-=mod;return a;}
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	int Sum1=0,Sum2=0;
	f[0][0]=1;
	for(rint i=0;i<2*n;++i)
	{	
		if(i+1<=n)
		{
			if(s[i+1]=='0') Sum1+=2;
			if(s[i+1]=='1') Sum1+=1,Sum2+=1;
			if(s[i+1]=='2') Sum2+=2;
		}
		for(rint j=0;j<=2*n;++j)
		{
			if(!f[i][j]) continue;
			if(Sum1-j>0)
			{
				f[i+1][j+1]=add(f[i+1][j+1],f[i][j]); 
			}
			if((Sum2-(i-j))>0)
			{
				f[i+1][j]=add(f[i+1][j],f[i][j]);
			}
		}
	}//int ans=0;
	//for(rint i=0;i<=n;++i) ans=add(ans,f[2*n][i]);
	cout<<f[2*n][Sum1];
	return 0;
}