#d11303. 矩阵游戏

矩阵游戏

Matrix Game

Problem Description

Little S is playing a game: he has a board of length NN and width MM, in which some cells are black (the rest are white).

In one operation he may choose a rectangular region whose length and width are both greater than 11; if exactly 33 of its four corner cells are black, he may paint the remaining white corner cell black.

Find how many different N×MN \times M boards satisfy both:

  • Little S can turn the entire board black after a finite number of operations;
  • the number of black cells used is minimal.

Two boards are different if and only if there exists at least one cell with a different color in the two boards. Output the answer modulo 998244353998244353.

Input Format

The first line contains a positive integer TT, the number of test cases.

For each test case, the first line contains two positive integers NN and MM.

Constraints: for all data, 1≤T≤1001 \le T \le 100, 1≤N≤1001 \le N \le 100, 1≤M≤1001 \le M \le 100.

Output Format

For each test case, output one integer on a single line: the answer.

Sample Input

2
1 1
2 2

Sample Output

1
4