#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
const int maxn = 4020;
const int mod = 998244353;
char s[maxn];
int f[maxn][maxn];
int red[maxn];
int blue[maxn];
int len;
int solve(int r, int b){
	if(r + b == 2*len) return 1;
	if(f[r][b] != -1) return f[r][b];
	int i = min(r + b, len - 1);
	int bb = blue[i], rr = red[i];
	bb -= b; rr -= r;
	int ans = 0;
	if(bb) ans += solve(r, b + 1);
	if(rr) ans += solve(r + 1, b);
	if(ans >= mod) ans -= mod;
	return f[r][b] = ans;
}
int main(){
	scanf("%s", s);
	len = strlen(s);
	for(int i = 0; i < len; i++) {
		if(s[i] == '0') red[i] = 2;
		if(s[i] == '1') red[i] = 1, blue[i] = 1;
		if(s[i] == '2') blue[i] = 2;
	}
	for(int i = 1; i < len; i++){
		red[i] += red[i - 1];
		blue[i] += blue[i - 1];
	}
	memset(f, -1, sizeof(f));
	printf("%d\n", solve(0, 0));
	return 0;
}
