atcoder#TENKA12019F. Banned X

Banned X

Score : 800800 points

Problem Statement

Find the number, modulo 998244353998244353, of sequences of length NN consisting of 00, 11 and 22 such that none of their contiguous subsequences totals to XX.

Constraints

  • 1N30001 \leq N \leq 3000
  • 1X2N1 \leq X \leq 2N
  • NN and XX are integers.

Input

Input is given from Standard Input in the following format:

NN XX

Output

Print the number, modulo 998244353998244353, of sequences that satisfy the condition.

3 3
14

1414 sequences satisfy the condition: $(0,0,0),(0,0,1),(0,0,2),(0,1,0),(0,1,1),(0,2,0),(0,2,2),(1,0,0),(1,0,1),(1,1,0),(2,0,0),(2,0,2),(2,2,0)$ and (2,2,2)(2,2,2).

8 6
1179
10 1
1024
9 13
18402
314 159
459765451