atcoder#ABC242F. [ABC242F] Black and White Rooks

[ABC242F] Black and White Rooks

Score : 500500 points

Problem Statement

Consider placing BB black rooks and WW white rooks on a grid with NN horizontal rows and MM vertical columns.

A placement of the rooks satisfying all of the following conditions is called a good placement.

  • All B+WB+W rooks are placed on the grid.
  • At most one rook is placed in the same square.
  • There is no pair of white rook and black rook attacking each other. That is, there is no pair of white rook and black rook such that one of them can reach the square in which the other is placed in one move.

Here, in one move, a rook can reach any square that is on a horizontal or vertical line from its current position and is reachable without jumping over another rook.

How many good placements are there? Since this count can be enormous, print it modulo 998244353998244353.

Rooks in the same color are not distinguished.

Constraints

  • 1N,M501 \leq N,M \leq 50
  • 1B,W25001 \leq B,W \leq 2500
  • B+WN×MB+W \leq N \times M
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM BB WW

Output

Print the count modulo 998244353998244353.

2 2 1 1
4

There are four good placements as follows.

1 2 1 1
0

There may be no good placement.

40 40 30 30
467620384

Be sure to print the count modulo 998244353998244353.