We call an n×n matrix containing only 0s and 1s bad if and only if it contains exactly one 1 in each row and column.
| Bad | Bad | Bad | Not Bad | Not Bad | Not Bad |
|---|---|---|---|---|---|
| \left\[\begin{matrix}0 & 1\\\1 & 0\end{matrix}\right] | \left\[\begin{matrix}1 & 0\\\0 & 1\end{matrix}\right] | \left\[\begin{matrix}1 & 0 & 0\\\0 & 0 & 1\\\0 & 1 & 0\end{matrix}\right] | \left\[\begin{matrix}1 & 1 & 0\\\1 & 0 & 1\\\0 & 1 & 1\end{matrix}\right] | \left\[\begin{matrix}0 & 0 & 0\\\0 & 1 & 0\\\0 & 0 & 0\end{matrix}\right] | \left\[\begin{matrix}0 & 0\\\0 & 0\end{matrix}\right] |
Define B to be a subrectangle of an n×n matrix A if and only if there exist 1≤l_1≤r_1≤n and 1≤l_2≤r_2≤n such that
| A | B | Explanation |
|---|---|---|
| \left\[\begin{matrix}1 & 0 & 0\\\0 & 0 & 1\\\0 & 1 & 1\end{matrix}\right] | \left\[\begin{matrix}0 & 0\\\ 0 & 1\end{matrix}\right] | \left\[\begin{matrix}1 & \mathbf{0} & \mathbf{0}\\\0 & \mathbf{0} & \mathbf{1}\\\0 & 1 & 1\end{matrix}\right] |
| \left\[\begin{matrix}1 & 0 & 0\\\0 & 0 & 1\\\0 & 1 & 1\end{matrix}\right] | \left\[\begin{matrix}1 & 0\\\ 0 & 0\end{matrix}\right] | \left\[\begin{matrix}\mathbf{1} & \mathbf{0} & 0\\\\\mathbf{0} & \mathbf{0} & 1\\\0 & 1 & 1\end{matrix}\right] |
| \left\[\begin{matrix}1 & 0 & 0\\\0 & 0 & 1\\\0 & 1 & 1\end{matrix}\right] | \left\[\begin{matrix}1 & 0\\\ 0 & 1\end{matrix}\right] | Not a subrectangle |
Given two integers n and m, you want to calculate how many n×n matrices M containing only 0s and 1s are there such that:
Since the answer can be large, output it modulo 998,244,353.
The first line contains two integers n and m (1≤m<n≤105).
Output a single line containing a single integer, indicating the answer modulo 998,244,353.
In the first example, there are 6 bad matrices. The second condition does not matter since m+1=3>n−1=2. So the answer is 6.
In the second example, there are 4 matrices satisfying the conditions:
| \left\[\begin{matrix}0 & 1 & 0 & 0\\\0 & 0 & 0 & 1 \\\ 1 & 0 & 0 & 0 \\\ 0 & 0 & 1 & 0 \end{matrix}\right] | \left\[\begin{matrix}0 & 0 & 1 & 0\\\1 & 0 & 0 & 0 \\\ 0 & 0 & 0 & 1 \\\ 0 & 1 & 0 & 0 \end{matrix}\right] | \left\[\begin{matrix}0 & 0 & 1 & 0\\\0 & 0 & 0 & 1 \\\ 1 & 0 & 0 & 0 \\\ 0 & 1 & 0 & 0 \end{matrix}\right] | \left\[\begin{matrix}0 & 1 & 0 & 0\\\1 & 0 & 0 & 0 \\\ 0 & 0 & 0 & 1 \\\ 0 & 0 & 1 & 0 \end{matrix}\right] |