AtCoder Regular Contest 166
C
LU / RD Marking
AtCoder
⌀ 1813
原题
← BD →
翻译中…

Problem Statement

翻译中…

There is a grid with $H$ rows and $W$ columns.

翻译中…

This grid has $H(W+1)$ vertical edges and $W(H+1)$ horizontal edges, for a total of $H(W+1) + W(H+1)$ (see also the figures at Sample Input/Output). Consider marking these edges by the following two kinds of operations.

翻译中…
  • Operation (1): Choose a square whose left and upper edges are unmarked when performing this operation. Mark the left and upper edges of that square.
  • Operation (2): Choose a square whose right and lower edges are unmarked when performing this operation. Mark the right and lower edges of that square.
翻译中…

Find the number, modulo $998244353$, of possible sets of edges that are eventually marked when Operations (1) and (2) can be performed any number of times, possibly zero.

翻译中…

You have $T$ test cases to solve.

翻译中…

Constraints

翻译中…
  • $1\leq T\leq 2\times 10^5$
  • $1\leq H, W\leq 10^6$
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

T
\text{case}_1
\vdots
\text{case}_T

翻译中…

Each test case is given in the following format:

翻译中…

H W

翻译中…

Output

翻译中…

Print $T$ lines. The $i$-th line should contain the number, modulo $998244353$, of possible sets of edges that are eventually marked for the $i$-th test case.

翻译中…

样例

Input #1
2
1 1
2 3
Output #1
4
800
For the case $(H, W)=(1,1)$, there are four possible sets of edges that are eventually marked, as shown below. The marked edges are drawn in bold. ![image](https://img.atcoder.jp/arc166/bd84a15ada55c0df6d4e66863053bd59.png) For the case $(H, W)=(2,3)$, the following sets of marked edges are **possible**: ![image](https://img.atcoder.jp/arc166/66c77b9132c38d82c36732966ff3ae4f.png) On the other hand, the following sets of marked edges are **impossible**: ![image](https://img.atcoder.jp/arc166/0029e3cc83a0232231ddf6e280c7f9a8.png)
Input #2
3
123 456
654 321
1000000 1000000
Output #2
60549740
298307903
656009181
题目信息
题号
arc166_c
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。