#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 998244353


//ここから編集する
class Combination {

public:
    vector<ll> fact;

    Combination(int max_n) {
        //1 ~ n!までの階乗modを求める
        int n = max_n;
        vector<ll> fact(n + 1);
        fact[0] = 1;
        for (int i = 1; i <= n; i++) {
            fact[i] = (fact[i - 1] * i) % MOD;
        }
        this->fact = fact;
    }

    template<typename T>
    //templateをつかってみｔか
    ll pow(T x, int y) {
        if (y == 0) return 1;
        if (y == 1) return x;
        if (y == 2) return (x * x) % MOD;
//        if (y % 2 == 1) return pow(x, y / 2) * pow(x, y / 2) % MOD;
        if (y % 2 == 1) return pow(pow(x, y / 2), 2) * x % MOD;
//        return pow(x, y / 2) * pow(x, y / 2) % MOD;
        return pow(pow(x, y / 2), 2) % MOD;
    }

    ll nCk(int n, int k) {
//        return (fact[n] * pow(fact[n-k],MOD-2) * pow(fact[k],MOD-2)) % MOD;
        return (((fact[n] * pow(fact[n - k], MOD - 2)) % MOD) * pow(fact[k], MOD - 2)) % MOD;
    }

    /**
     * x ^ -1を求める
     */
    template<typename T>
    ll inv(T x) {
        return pow(x, MOD - 2);
    }
};

Combination cmb(4001);

class Solve {
public:
    string S;
    vector<Int> B;
    vector<Int> C;
    Int N;

    void solve() {
        cin >> S;
        N = S.size();
        B.resize(N + 1);
        C.resize(N + 1);
        for (int i = 0; i < N; ++i) {
            B[i] = S[i] - '0';
        }
        C[0] = B[0];
        for (int i = 1; i < N; ++i) {
            C[i] = B[i] + C[i - 1];
        }
        vector<vector<Int>> dp(N + 1, vector<Int>(2 * N + 1));

        dp[0][0] = 1;

        for (int i = 0; i < N; ++i) {

            for (int j = 0; j <= i; ++j) {
                dp[i][j] %= MOD;
                Int b = 0;
                Int r = 0;

                if (i > 0) {
                    b = C[i - 1] - j;
                    r = (2 * i - C[i - 1]) - (i - j);
                }
                if (b < 0) continue;

                // あお追加できる場合
                if (b > 0 || B[i] > 0) {
                    (dp[i + 1][j + 1] += dp[i][j]) %= MOD;
                }

                // あか追加できる場合
                if (r > 0 || B[i] <= 1) {
                    (dp[i + 1][j] += dp[i][j]) %= MOD;
                }

            }
        }

        Int ans = 0;

        for (int i = 0; i <= N; ++i) {
            Int blue = C[N - 1] - i;
            Int red = (2 * N - C[N - 1]) - (N - i);
            if (blue + red != N) {
                exit(-1);
            }

            if (blue >= 0 && red >= 0) {
                Int left = dp[N][i] % MOD;
                Int right = cmb.nCk(blue + red, blue);
                Int tmp = (left * right) % MOD;
                ans += tmp;
                ans %= MOD;
            }
        }
        cout << ans << endl;


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 63104