{"problem":{"name":"Japanese \"Knight's Tour\"","description":{"content":"There is a shogi (Japanese chess) board with $H$ rows and $W$ columns, and one knight piece. The square at the $i$\\-th row from the top and $j$\\-th column from the left of the board is represented as ","description_type":"Markdown"},"platform":"AtCoder","limit":{"time_limit":2000,"memory_limit":262144},"difficulty":"None","is_remote":true,"is_sync":true,"sync_url":null,"sign":"arc202_b"},"statements":[{"statement_type":"Markdown","content":"There is a shogi (Japanese chess) board with $H$ rows and $W$ columns, and one knight piece. The square at the $i$\\-th row from the top and $j$\\-th column from the left of the board is represented as $(i-1, j-1)$. (Note that the values are shifted by $1$.)  \nThis board is a torus, meaning the top and bottom are connected, and the left and right are connected. A knight at $(i, j)$ can move to $((i-2) \\bmod H, (j-1) \\bmod W)$ or $((i-2) \\bmod H, (j+1) \\bmod W)$. (Note that this is different from the knight in Standard chess.)\nMoving the knight on the board to satisfy the following condition is called a **tour**.\n\n*   Initially, place the knight at $(0, 0)$. Then, move the knight $H \\times W$ times so that the knight visits every square exactly once. Finally, the knight returns to $(0, 0)$.\n\nFind the number of tours modulo $998244353$. Two tours are considered different if and only if there exists an integer $i$ $(1 \\leq i \\leq H\\times W)$ such that the destination of the $i$\\-th move is different.\n\n## Constraints\n\n*   $3 \\leq H \\leq 2 \\times 10^5$\n*   $3 \\leq W \\leq 2 \\times 10^5$\n*   All input values are integers.\n\n## Input\n\nThe input is given from Standard Input in the following format:\n\n$H$ $W$\n\n[samples]","is_translate":false,"language":"English"}],"meta":{"iden":"arc202_b","tags":[],"sample_group":[["3 3","6\n\nFor example, the movement $(0,0) \\to (1,1) \\to (2,2) \\to (0,1) \\to (1,2) \\to (2,0) \\to (0,2) \\to (1,0) \\to (2,1) \\to (0,0)$ satisfies the conditions as a tour.  \nThere are six tours in total."],["123 45","993644157"],["6789 200000","152401277"]],"created_at":"2026-03-03 11:01:14"}}