#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define per(i,a,b) for(int i=a;i>=b;i--)
typedef long long ll;
typedef double db;
const int maxn = 4e3 + 5;
const ll mod = 998244353;

int n;
char s[maxn];
ll dp[maxn][maxn];
int a[maxn], b[maxn];

template<class T>
void add(T &x, T &y){ x += y; if(x >= mod) x -= mod; }

int main(){
    scanf("%s", s + 1);
    n = strlen(s + 1);
    rep(i, 1, n)
        a[i] = a[i-1] + 2 - (s[i] - '0'), b[i] = b[i-1] + s[i] - '0';
    dp[0][0] = 1;
    rep(i, 0, 2 * n)
        rep(j, 0, i)
            if(dp[i][j]){
                if(a[min(i + 1, n)] > j)
                    add(dp[i+1][j+1], dp[i][j]);
                if(b[min(i + 1, n)] > i - j)
                    add(dp[i+1][j], dp[i][j]);
            }
    printf("%lld\n", dp[2*n][a[n]]);
    return 0;
}
