program extension
  implicit none
  integer(8), parameter :: m = 998244353
  integer :: a, b, c, d, i, j
  integer(8) :: dp(3001, 3001) = 0
  read(*,*) a, b, c, d
  dp(a, b) = 1
  do i = a, c
    do j = b, d
      dp(i + 1, j) = mod(dp(i + 1, j) + dp(i, j) * j, m)
      dp(i, j + 1) = mod(dp(i, j + 1) + dp(i, j) * i, m)
      dp(i + 1, j + 1) = mod(dp(i + 1, j + 1) - dp(i, j) * i * j, m)
    end do
  end do
  write(*,'(i0)') dp(c, d)
end program extension