#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
const int N=4001;
char s[N];
int t[N];
typedef long long ll;
int fac[N],inv[N],finv[N];
template<class T>inline void Inc(T&x,int y){x+=y;if(x>=mod) x-=mod;}
inline int C(int n,int m){if(n<m) return 0;return (ll)fac[n]*finv[m]%mod*finv[n-m]%mod;}
int n;
int dp[N][N];
int main()
{
	scanf("%s",s+1);n=strlen(s+1);
	int red=0,blue=0;fac[0]=finv[0]=1;inv[1]=1;
	for(int i=2;i<=n;++i) inv[i]=(ll)(mod-mod/i)*inv[mod%i]%mod;
	for(int i=1;i<=n;++i) fac[i]=(ll)fac[i-1]*i%mod,finv[i]=(ll)finv[i-1]*inv[i]%mod;
	for(int i=1;i<=n;++i) t[i]=s[i]-'0';
	dp[0][0]=1;
	for(int i=1;i<=n;++i) {
		if(t[i]==1) ++red,++blue;else if(t[i]==0) red+=2;else blue+=2;
		for(int j=0;j<=red;++j){
			if(j>0) Inc(dp[i][j],dp[i-1][j-1]);
			if(i-j<=blue) Inc(dp[i][j],dp[i-1][j]);
		}
	}
	int ans=0;
	for(int i=0;i<=red;++i) {int f=dp[n][i];Inc(ans,(ll)f*C(n,red-i)%mod);}
	printf("%d\n",ans);
}
