#include <iostream>
#include <string>
#define llint long long
#define mod 998244353

using namespace std;

string s;
llint sumR[2005], sumB[2005];
llint dp[4005][4005];

int main(void)
{
	cin >> s;
	int n = s.size();
	s = "#" + s;
	
	for(int i = 1; i <= n; i++){
		sumR[i] = sumR[i-1];
		sumB[i] = sumB[i-1];
		if(s[i] == '0') sumR[i] += 2;
		if(s[i] == '1') sumR[i]++, sumB[i]++;
		if(s[i] == '2') sumB[i] += 2;
	}
	
	dp[0][0] = 1;
	for(int i = 1; i <= 2*n; i++){
		for(int j = 0; j <= 2*n; j++){
			dp[i][j] += dp[i-1][j], dp[i][j] %= mod;
			if(j > 0) dp[i][j] += dp[i-1][j-1], dp[i][j] %= mod;
			if(i <= n && (j > sumR[i] || i-j > sumB[i])) dp[i][j] = 0;
		}
	}
	cout << dp[2*n][sumR[n]] << endl;
	
	return 0;
}