You are given a rectangular grid $$$B$$$ with $$$N$$$ rows and $$$M$$$ columns. Consider some rectangular grid $$$A$$$ with $$$N$$$ rows and $$$M$$$ columns. $$$A$$$ is considered mediocre if $$$A_{i, j}$$$ is an integer and $$$0 \leq A_{i, j} \leq B_{i, j}$$$ for all $$$(i, j)$$$.
Let $$$F(A) = \displaystyle\left(\prod_{i = 1}^{N}\left(\sum_{j = 1}^{M}A_{i, j}\right)\right) \displaystyle\left(\prod_{j = 1}^{M}\left(\sum_{i = 1}^{N}A_{i, j}\right)\right)$$$.
Calculate the sum of $$$F(A)$$$ over all mediocre $$$A$$$ modulo $$$998244353$$$.
The first line contains two positive integers $$$N$$$ and $$$M$$$ $$$(1 \leq N \cdot M \leq 300)$$$.
Each of the next $$$N$$$ lines contains $$$M$$$ integers $$$B_{i, j}$$$ $$$(0 \leq B_{i, j} \leq 10^9)$$$.
—
There are $$$20$$$ tests, not including samples. Each test is worth $$$\frac{100}{20}=5$$$ points.
Tests $$$1 - 2$$$ satisfy $$$N = 1$$$.
Tests $$$3 - 12$$$ satisfy $$$N \cdot M \leq 100$$$.
The remaining tests do not satisfy any additional constraints.
Print one integer — the sum of $$$F(A)$$$ over all mediocre $$$A$$$ modulo $$$998244353$$$.
1 31 2 1
11
2 21 10 1
5
2 31 1 11 1 1
312
3 369 420 37666 777 888998244353 123456789 987654321
57820980
—
Problem Idea: HaccerKat
Problem Preparation: HaccerKat
Occurrences: Advanced J