import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

immutable long MOD = 998244353;

void main() {
    auto S = readln.chomp;
    auto N = S.length.to!int;

    long ans = 1;

    auto dp = new long[][](2, 2*N+1); // これまで何個赤を使っているか？
    dp[0][0] = 1;

    int red = 0;
    int blue = 0;
    int cur = 0;
    int tar = 1;

    foreach (i; 0..2*N) {
        dp[tar][] = 0;

        int cand = (i + 1) * 2 - i;

        if (i < N) {
            red += 2 - (S[i] - '0');
            blue += S[i] - '0';
        }

        foreach (used_red; 0..2*N+1) {
            if (dp[cur][used_red] == 0) continue;

            int used_blue = i - used_red;
            int rest_red = red - used_red;
            int rest_blue = blue - used_blue;

            if (rest_red > 0) {
                (dp[tar][used_red+1] += dp[cur][used_red]) %= MOD;
            }
            if (rest_blue > 0) {
                (dp[tar][used_red] += dp[cur][used_red]) %= MOD;
            }
        }
        swap(cur, tar);
    }

    dp[cur][red].writeln;
}
