F - Hanjo 2 解説 /

実行時間制限: 2 sec / メモリ制限: 1024 MB

配点 : 600

問題文

H メートル、横 W メートルの長方形の部屋があります。
この部屋に 2 メートル × 1 メートルの区別できない畳 (長方形のタイル) と、1 メートル × 1 メートルの区別できない半畳 (正方形のタイル) を敷き詰めます。 2 メートル × 1 メートルの畳は縦長にも横長にも使うことができます。
敷き詰める方法は何通りあるでしょうか?
回転や反転を行うことで初めて一致するような敷き詰め方は区別します。

答えは非常に大きくなる可能性があるので 998244353 で割ったあまりを求めてください。

制約

  • 1 \leq H \leq 6
  • 1 \leq W \leq 10^{12}

入力

入力は以下の形式で標準入力から与えられる。

H W

出力

答えを出力せよ。


入力例 1

2 2

出力例 1

7

以下の 7 つです。


入力例 2

3 3

出力例 2

131

入力例 3

5 100

出力例 3

379944232

998244353 で割ったあまりを求めてください。

Score : 600 points

Problem Statement

We have a rectangular room that is H meters long and W meters wide.
We will fill this entire room with tatami (rectangular mats) that are 2 meters long and 1 meter wide, and hanjo (square mats) that are 1 meter long and 1 meter wide. Each tatami can be placed vertically or horizontally.
How many ways are there to fill the room?
We distinguish ways that match only after rotation or reflection.

Since the count can be enormous, find it modulo 998244353.

Constraints

  • 1 \leq H \leq 6
  • 1 \leq W \leq 10^{12}

Input

Input is given from Standard Input in the following format:

H W

Output

Print the answer.


Sample Input 1

2 2

Sample Output 1

7

We have the following seven ways:


Sample Input 2

3 3

Sample Output 2

131

Sample Input 3

5 100

Sample Output 3

379944232

Be sure to find the count modulo 998244353.