#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

const int mod = 998244353;

template< int mod >
struct ModInt {
  int x;

  ModInt() : x(0) {}

  ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {}

  ModInt &operator+=(const ModInt &p) {
    if((x += p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator-=(const ModInt &p) {
    if((x += mod - p.x) >= mod) x -= mod;
    return *this;
  }

  ModInt &operator*=(const ModInt &p) {
    x = (int) (1LL * x * p.x % mod);
    return *this;
  }

  ModInt &operator/=(const ModInt &p) {
    *this *= p.inverse();
    return *this;
  }

  ModInt operator-() const { return ModInt(-x); }

  ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; }

  ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; }

  ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; }

  ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; }

  bool operator==(const ModInt &p) const { return x == p.x; }

  bool operator!=(const ModInt &p) const { return x != p.x; }

  ModInt inverse() const {
    int a = x, b = mod, u = 1, v = 0, t;
    while(b > 0) {
      t = a / b;
      swap(a -= t * b, b);
      swap(u -= t * v, v);
    }
    return ModInt(u);
  }

  ModInt pow(int64_t n) const {
    ModInt ret(1), mul(x);
    while(n > 0) {
      if(n & 1) ret *= mul;
      mul *= mul;
      n >>= 1;
    }
    return ret;
  }

  friend ostream &operator<<(ostream &os, const ModInt &p) {
    return os << p.x;
  }

  friend istream &operator>>(istream &is, ModInt &a) {
    int64_t t;
    is >> t;
    a = ModInt< mod >(t);
    return (is);
  }

  static int get_mod() { return mod; }
};

using modint = ModInt< mod >;

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);

  string s;
  cin >> s;
  int n = s.size();

  vector<vector<modint> > dp(n+1,vector<modint>(4*n+1,0));
  rep(i,n){
    rep(j,4*n){
      int red = (j - n*2 + i);
      int blue = (-(j-2*n)+i);
      if(red>=0 && blue>=0){        
        red/=2;blue/=2;
        if(red+blue!=i) continue;
        // cout << "i red blue " << i << " " << red << " "<< blue << endl;
        int nred,nblue;
        if(s[i]=='0'){
          if(i!=0) {
            dp[i][red+1-blue+2*n] += dp[i-1][j];
            if(blue>0){
              dp[i][red+2-(blue-1)+2*n] += dp[i-1][j];
            }
          }
          else dp[i][j+1] += 1;
        }
        else if(s[i]=='1'){
          if(i!=0){
            dp[i][j+1] += dp[i-1][j];
            dp[i][j-1] += dp[i-1][j];
          }
          else{
            dp[i][j+1] += 1;
            dp[i][j-1] += 1;
          }
        }
        else if(s[i]=='2'){
          if(i!=0){
            dp[i][j-1] += dp[i-1][j];
            if(red>0) dp[i][red-1-(blue+2)+2*n] += dp[i-1][j];
          }
          else dp[i][j-1] += 1;
        }
      }
    }
  }
  vector<modint> fact(n+1,1);
  vector<modint> inv(n+1,1);
  fact[0]=1;
  rep1(i,n) fact[i] = fact[i-1]*i;
  rep(i,n+1) inv[i] = ((modint) 1)/fact[i];
  vector<modint> comb(n+1);
  rep(i,n+1) comb[i] = fact[n]*inv[i]*inv[n-i];

  modint ans =0;
  rep(i,4*n){
    // if(dp[n-1][i]!=0) cout << i <<" "<< dp[n-1][i] << endl;
    int red = (i-n*2+n)/2;
    int blue = (-(i-2*n)+n)/2;
    ans += comb[red]*dp[n-1][i];
  }
  cout << ans << endl;
  
  return 0;
    

}


Measured memory_bytes: 62848