#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define N 4010
#define mod 998244353
ll f[N][N],c[N],d[N];
int main(){
  string s;cin>>s;
  for(int i=0;i<N;i++)c[i]=d[i]=1e17;
  c[0]=0; for(int i=0;i<s.size();i++)c[i+1]=c[i]+(s[i]-'0');
  d[0]=0; for(int i=0;i<s.size();i++)d[i+1]=d[i]+('2'-s[i]);
  for(int i=0;i<N;i++)for(int j=0;j<N;j++) f[i][j]=0; f[0][0]=1;
  for(int i=0;i<=c[s.size()];i++)for(int j=0;j<=d[s.size()];j++){
    ll k=i+j+1;
    if(c[k]>i)f[i+1][j]=(f[i+1][j]+f[i][j])%mod;
    if(d[k]>j)f[i][j+1]=(f[i][j+1]+f[i][j])%mod;
  }
  cout<<f[c[s.size()]][d[s.size()]]<<endl;
  return 0;
}
