Score : 1800 points
We have a square grid with N rows and M columns. Takahashi will write an integer in each of the squares, as follows:
Now we have a grid where each square contains 0, 1, or 2. Find the number of different grids that can be made this way, modulo 998244353. We consider two grids different when there exists a square with different integers.
Input is given from Standard Input in the following format:
N M
Print the number of different grids that can be made, modulo 998244353.
1 2
8
Let (a,b) denote the grid where the square to the left contains a and the square to the right contains b. Eight grids can be made: (0,0),(0,1),(1,0),(1,1),(1,2),(2,0),(2,1), and (2,2).
2 3
234
10 7
995651918
314159 265358
70273732