program pass_
  implicit none
  integer(8), parameter :: md = 998244353_8
  character(2000) :: s
  integer :: n, m, i, j, a, r(0:2000) = 0, b(0:2000) = 0, x, y
  integer(8) :: dp(0:4000,0:4000) = 0_8
  dp(0,0) = 1_8
  read(*,*) s
  n = len_trim(s)
  m = 2*n
  do i = 1, n
    a = ichar(s(i:i))-48
    r(i) = r(i-1)+2-a
    b(i) = b(i-1)+a
  end do
  do i = 1, m
    x = r(min(i,n))
    y = b(min(i,n))
    do j = 0, i
      if (x < j .or. y < i-j) cycle
      dp(i,j) = dp(i-1,j)
      if (j /= 0) dp(i,j) = mod(dp(i,j)+dp(i-1,j-1),md)
    end do
  end do
  write(*,'(i0)') dp(m,r(n))
end program pass_