P28980 [洛谷] [Cnoi2019] The Promise of the Cedar Tree
提高+
题目描述

Problem Description

Cirno defines a type of graph: the cylindrical network \( G(L, x) \).

\( G(L, x) \) represents a graph with \( L \times x \) nodes.

Each node is represented by an integer pair \( (a, b) \) where \( 1 \le a \le L \) and \( 1 \le b \le x \).

For \( \forall i \in (1, L], \ j \in (0, x] \), there is an edge between node \( (i, j) \) and node \( (i - 1, j) \).

For \( \forall i \in [1, L], \ j \in (0, x) \), there is an edge between node \( (i, j) \) and node \( (i, j + 1) \).

For \( \forall i \in [1, L] \), there is an edge between node \( (i, x) \) and node \( (i, 1) \).

Now, Cirno wants to know the number of independent sets in \( G(L, x) \).

Since you do not have high precision, you need to take the answer modulo \( 998244353 \).

Input Format

One line containing two integers, \( L \) and \( x \).

Output Format

One line containing one integer, the number of independent sets in \( G(L, x) \) modulo \( 998244353 \).

Sample Input and Output

Sample Input #1

3 4

Sample Output #1

181

Sample Input #2

1000 8

Sample Output #2

124141757

Notes

For the first \( 10\% \) of the data, \( L, x \le 8 \).

For the first \( 30\% \) of the data, \( x \le 8 \).

For the first \( 50\% \) of the data, \( x \le 11 \).

For \( 100\% \) of the data, \( 0 < L \le 10^{18}, 0 < x \le 17 \).

This problem uses bundled testing.

The following image is an example of \( G(3, 4) \).

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 4
样例输出
181