The Pool

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

Marisa wants to build an n×mn \times m rectangular swimming pool for Alice. To do this, Marisa can select four integer points on an infinite two-dimensional grid, and cast magic. For example, the following picture shows three possible ways to build a 5×55 \times 5 swimming pool.

Marisa soon learns that there are many ways to build the pool since four sides of the pool can be non-parallel to coordinate axes. Here two ways are considered different if and only if the pool in one way can't be translated (moved without rotation and flipping) to the pool in the other way. Now Marisa becomes curious about the total number of 1×11 \times 1 squares completely inside the pool for all possible ways. As the result can be very large, you should print it modulo 998,244,353998\\,244\\,353.

입력

The first line contains one integer TT (1T1041\leq T\leq 10^4) denoting the number of test cases.

Each test case is given on a single line containing two integers nn and mm (1n,m10181 \leq n, m \leq 10^{18}) denoting the size of swimming pool.

It is guaranteed that there are at most 10 cases where max(n,m)>109\max(n, m) > 10^9.

출력

For each test case, print one number, denoting the total number of 1×11 \times 1 squares completely inside the pool for all possible ways (modulo 998,244,353998\\,244\\,353).

힌트

As shown in the picture, there are exactly three different ways to build the pool. The corresponding numbers of 1×11 \times 1 squares completely inside the pool in these three ways are 2525, 1313, and 1313. So the total number is 5151.