#ARC139E. [ARC139E] Wazir

[ARC139E] Wazir

Score : 800800 points

Problem Statement

We have a grid with HH rows and WW columns. Let (i,j)(i, j) denote the square at the ii-th row from the top and jj-th column from the left. Assume that this grid is a torus; that is, in addition to the pairs of squares horizontally or vertically adjacent to each other, assume the following pairs of squares to be adjacent to each other.

  • (i,1)(i,1) and (i,W)(i,W), for every integer ii such that 1iH1 \leq i \leq H.
  • (1,j)(1,j) and (H,j)(H,j), for every integer jj such that 1jW1 \leq j \leq W.

Consider placing some number of pieces on the squares in the grid. Here, there can be at most one piece on each square, and there cannot be two pieces on adjacent squares. Let LL be the maximum number of pieces that can be placed. Find the number of ways, modulo 998244353998244353, to place LL pieces.

Constraints

  • 2H1052 \leq H \leq 10^5
  • 2W10102 \leq W \leq 10^{10}
  • HH and WW are integers.

Input

Input is given from Standard Input in the following format:

HH WW

Output

Print the answer.

3 2
6

The following six placements satisfy the condition. Here, # and . represent a square with and without a piece, respectively.

#.   #.   .#   .#   ..   ..
.#   ..   #.   ..   #.   .#
..   .#   ..   #.   .#   #.
139 424
148734121
12345 1234567890
227996418