#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
const int MAX_N=2e3;
const ll MOD=998244353;
string S;
ll dp[MAX_N*2+1][MAX_N*2+1];
int rcnt[MAX_N+1],bcnt[MAX_N+1];
int main(){
	cin>>S;
	int N=(int)S.size();
	REP(i,N){
		int b=S[i]-'0';
		bcnt[i+1]=bcnt[i]+b;
		rcnt[i+1]=rcnt[i]+2-b;
	}
	dp[rcnt[N]][bcnt[N]]=1;
	for(int n=rcnt[N];n>=0;n--){
		for(int m=bcnt[N];m>=0;m--){
			if(n==rcnt[N] && m==bcnt[N])continue;
			int rlb=upper_bound(rcnt,rcnt+N+1,n)-rcnt-1,blb=upper_bound(bcnt,bcnt+N+1,m)-bcnt-1;
			if(n+m>=rlb){
				dp[n][m]+=dp[n+1][m];
			}
			if(n+m>=blb){
				dp[n][m]+=dp[n][m+1];
				dp[n][m]%=MOD;
			}
		}
	}
	cout<<dp[0][0]<<endl;
}