9321: ABC297 —— F - Minimum Bounding Box 2
[Creator : ]
Description
We have a grid with $H$ rows and $W$ columns.
We choose $K$ cells in this grid uniformly at random. The score is the number of cells in the minimum rectangle (whose edges are parallel to the axes of the grid) that contains all of the chosen cells.
Find the expected score modulo $998244353$.
What is rational number modulo $998244353$? We can prove that the sought expected value is always a rational number. Moreover, under the Constraints of this problem, when the value is represented as $\frac{P}{Q}$ by two coprime integers $P$ and $Q$, we can prove that there is a unique integer $R$ such that $R \times Q \equiv P\pmod{998244353}$ and $0 \leq R \lt 998244353$. Find such $R$.
We choose $K$ cells in this grid uniformly at random. The score is the number of cells in the minimum rectangle (whose edges are parallel to the axes of the grid) that contains all of the chosen cells.
Find the expected score modulo $998244353$.
What is rational number modulo $998244353$? We can prove that the sought expected value is always a rational number. Moreover, under the Constraints of this problem, when the value is represented as $\frac{P}{Q}$ by two coprime integers $P$ and $Q$, we can prove that there is a unique integer $R$ such that $R \times Q \equiv P\pmod{998244353}$ and $0 \leq R \lt 998244353$. Find such $R$.
Input
The input is given from Standard Input in the following format:
```
$H$ $W$ $K$
```
```
$H$ $W$ $K$
```
Output
Print the answer.
Constraints
$1\leq H,W \leq 1000$
$1\leq K \leq HW$
All values in the input are integers.
$1\leq K \leq HW$
All values in the input are integers.
Sample 1 Input
2 2 2
Sample 1 Output
665496238
The score equals 4 in the following two cases: if cells (1,1) and (2,2) are chosen, or cells (1,2) and (2,1) are chosen. The other four cases yield a score of 2.
Thus, the expected score equals $\frac{4×2+2×4}{6}=\frac{8}{3}$. Since $665496238×3≡8(\bmod\ {998244353})$, you should print 665496238.
Thus, the expected score equals $\frac{4×2+2×4}{6}=\frac{8}{3}$. Since $665496238×3≡8(\bmod\ {998244353})$, you should print 665496238.
Sample 2 Input
10 10 1
Sample 2 Output
1
Sample 3 Input
314 159 2653
Sample 3 Output
639716353