#CF2240B. AI 在这里什么也找不到 / B. AI Finds Nothing Here

AI 在这里什么也找不到 / B. AI Finds Nothing Here

B. AI Finds Nothing Here

Source: Codeforces 2240B
Contest: Codeforces Round 1105 (Div. 2)
Time limit: 1 second
Memory limit: 256 megabytes

Statement

Milkcat2009 has a matrix aa with nn rows and mm columns consisting of integers 00 and 11. The rows are numbered from 11 to nn, and the columns are numbered from 11 to mm. The element in the ii-th row and jj-th column is denoted as ai,ja_{i,j}.

Milkcat2009's AI scans every single submatrix^{\text{∗}} of aa consisting of rr rows and cc columns. The AI considers the matrix clean if the bitwise XOR sum of elements in each such submatrix is equal to 00.

Formally, the matrix aa is valid if and only if for all 1inr+11 \le i \le n - r + 1 and 1jmc+11 \le j \le m - c + 1: $$ \bigoplus_{x=i}^{i+r-1} \bigoplus_{y=j}^{j+c-1} a_{x,y} = 0 $$

where \oplus denotes summation with the bitwise XOR operation.

Your task is, given various sets of integers n,m,r,cn, m, r, c, to count the number of clean matrices of nn rows and mm columns with respect to scanning dimensions rr and cc. Since the answer can be very large, calculate it modulo 998244353998\,244\,353.

^{\text{∗}}A submatrix of a matrix is obtained by removing some rows (from the beginning and/or end) and/or columns (from the beginning and/or end) from the original matrix.

Input

Each test contains multiple test cases. The first line contains the number of test cases tt (1t1041 \le t \le 10^4). The description of the test cases follows.

Each test case consists of a single line containing four integers n,m,r,cn, m, r, c (1rn1091 \le r \le n \le 10^9, 1cm1091 \le c \le m \le 10^9), representing the dimensions of the matrix and the dimensions of the scanning area, respectively.

Output

For each test case, output a single integer representing the answer modulo 998244353998\,244\,353.

Note

For the first test case. The only element a1,1a_{1,1} must satisfy a1,1=0a_{1,1} = 0. Since a1,1a_{1,1} must be 00, there is only 11 valid matrix: [0][0].

For the second test case.The condition requires the XOR sum of every 1×21 \times 2 submatrix to be 00. This implies ai,jai,j+1=0a_{i,j} \oplus a_{i,j+1} = 0, so ai,j=ai,j+1a_{i,j} = a_{i,j+1} for all valid i,ji,j. For each row, all elements must be equal. Thus, each row can be either [0,0,0][0, 0, 0] or [1,1,1][1, 1, 1]. With 22 rows, there are 22=42^2 =4 valid matrices.

Examples

8
1 1 1 1
2 3 1 2
2 5 2 2
3 5 2 2
4 6 2 2
100 14 52 6
1000000000 1000000000 1000000000 1000000000
1000000000 1000000000 1 1
1
4
64
128
512
543661425
121099884
1