Score : $700$ points
We have a rectangular piece of paper divided into $H \times W$ squares, where two of those squares are painted black and the rest are painted white. If we let $(i, j)$ denote the square at the $i$-th row and $j$-th column, the squares painted black are $(h_1, w_1)$ and $(h_2, w_2)$.
Maroon will repeat the following operation to cut the piece of paper:
Find the expected value of the number of times Maroon cuts a piece of paper until he ends the process, modulo $998244353$.
We can prove that the expected value in question is always a rational number. Additionally, under the constraints of this problem, we can also prove that if we express that value as an irreducible fraction $\frac{P}{Q}$, we have $Q \not \equiv 0 \pmod{998244353}$. Thus, there exists a unique integer $R$ such that $R \times Q \equiv P \pmod{998244353}, 0 \leq R < 998244353$. Answer this $R$.
Input is given from Standard Input in the following format:
$H$ $W$ $h_1$ $w_1$ $h_2$ $w_2$
Find the expected value of the number of times Maroon cuts a piece of paper until he ends the process, modulo $998244353$.
2 3 2 2 1 1
332748119
In the first cut, the process will end with probability $2/3$. For the remaining case with probability $1/3$, the process will end in the second cut.
Thus, the expected number of cuts is $1 \times 2/3 + 2 \times 1/3 = 4/3$.
1 5 1 2 1 3
332748120
2 1 2 1 1 1
1
The process will always end in the first cut.
10 10 3 4 5 6
831078040