Time limit: 1s
Memory limit: 256MB
Input:
Output:
A binary matrix with rows and columns is considered good if it has no or submatrices consisting of equal elements.
For example, and are good, while and are not.
Given two integers and , what is the maximum number of 's in a good matrix with rows and columns?
Input
Each test contains multiple testcases. The first line of input contains one integer () — the number of testcases.
The first line of each testcase contains two integers and () — the height and width of the matrix.
Output
For each testcase, print one integer, the maximum number of 's in a good matrix with rows and columns.
Example
stdin
6
3 3
3 4
126 74
169 208
1000000000 987654320
976875237 848936273
stdout
6
8
6216
23435
658436213333333334
552869881923181134