#P15864. [LBA-OI R3 D] 阵列之弈

[LBA-OI R3 D] 阵列之弈

Description

We are given a basketball court with nn horizontal division lines and mm vertical division lines, dividing the court into an n×mn \times m grid of regions.

The coach assigns a unique formation number (from 00 to nm1nm-1) to each region, forming a formation matrix.

The formation diversity value of a matrix is defined as the number of distinct values of the minimum missing formation number across all submatrices of the matrix.

::::info[Example]{open} If the formation numbers in a submatrix are {0,1,3,4}\{0,1,3,4\}, the minimum missing number is 22. If the formation numbers in a submatrix are {0,2}\{0,2\}, the minimum missing number is 11. ::::

Find the sum of the formation diversity values over all possible formation matrices. Since the answer can be large, output it modulo 998244353998244353.


Formal Statement

Given n,mn, m. An n×mn \times m matrix is valid if it is a permutation of integers from 00 to nm1nm-1. Define valval of a matrix as the size of the set containing the mex\text{mex} of all its submatrices. Compute the sum of valval over all valid matrices, modulo 998244353998244353.

::::success[Definition of Submatrix] A submatrix is formed by deleting a prefix of rows/columns and a suffix of rows/columns from the original matrix. ::::

Input Format

One line with two integers n,mn, m.

Output Format

One integer representing the answer modulo 998244353998244353.

1 2
6
1 20
704442100
10 10
506259194

Hint

Explanation of Sample 1

There are two valid matrices:

  1. 0 1
  2. 1 0

For 0 1, the submatrices are 0 (mex = 11), 1 (mex = 00), 0 1 (mex = 22). The set is {0,1,2}\{0,1,2\}, so val=3val = 3. The case 1 0 is symmetric. Total answer: 3+3=63 + 3 = 6.

Data Constraints

Subtask n×mn \times m Special Property Score
11 8\le 8 A 1010
22 5×106\le 5 \times 10^6
33 225\le 225 B
44 6400\le 6400 C 2020
55 1.6×105\le 1.6 \times 10^5 D 1010
66 5×105\le 5 \times 10^5 None 2020
77 5×106\le 5 \times 10^6

Special Property A: n=1n = 1. Special Property B: n,m15n, m \le 15. Special Property C: n,m80n, m \le 80. Special Property D: n,m400n, m \le 400.

For 100%100\% data: 1n×m5×1061 \le n \times m \le 5 \times 10^6. Please pay attention to the constant complexity of your implementation.