atcoder#ABC281H. [ABC281Ex] Alchemy

[ABC281Ex] Alchemy

Score : 600600 points

Problem Statement

Takahashi has AA kinds of level-11 gems, and 101010010^{10^{100}} gems of each of those kinds. For an integer nn greater than or equal to 22, he can put nn gems that satisfy all of the following conditions into a cauldron to generate a level-nn gem in return.

  • No two gems are of the same kind.
  • Every gem's level is less than nn.
  • For every integer xx greater than or equal to 22, there is at most one level-xx gem.

Find the number of kinds of level-NN gems that Takahashi can obtain, modulo 998244353998244353.

Here, two level-22 or higher gems are considered to be of the same kind if and only if they are generated from the same set of gems.

  • Two sets of gems are distinguished if and only if there is a gem in one of those sets such that the other set does not contain a gem of the same kind.

Any level-11 gem and any level-22 or higher gem are of different kinds.

Constraints

  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 1A1091 \leq A \leq 10^9
  • NN and AA are integers.

Input

The input is given from Standard Input in the following format:

NN AA

Output

Print the answer.

3 3
10

Here are ten ways to obtain a level-33 gem.

  • Put three kinds of level-11 gems into the cauldron.- Takahashi has three kinds of level-11 gems, so there is one way to choose three kinds of level-11 gems. Thus, he can obtain one kind of level-33 gem in this way.
  • Takahashi has three kinds of level-11 gems, so there is one way to choose three kinds of level-11 gems. Thus, he can obtain one kind of level-33 gem in this way.
  • Put one kind of level-22 gem and two kinds of level-11 gems into the cauldron.- A level-22 gem can be obtained by putting two kinds of level-11 gems into the cauldron.- Takahashi has three kinds of level-11 gems, so there are three ways to choose two kinds of level-11 gems. Thus, three kinds of level-22 gems are available here.
    • There are three kinds of level-22 gems, and three ways to choose two kinds of level-11 gems, so he can obtain 3×3=93 \times 3 = 9 kinds of level-33 gems in this way.
  • A level-22 gem can be obtained by putting two kinds of level-11 gems into the cauldron.
  • Takahashi has three kinds of level-11 gems, so there are three ways to choose two kinds of level-11 gems. Thus, three kinds of level-22 gems are available here.
  • There are three kinds of level-22 gems, and three ways to choose two kinds of level-11 gems, so he can obtain 3×3=93 \times 3 = 9 kinds of level-33 gems in this way.
1 100
100
200000 1000000000
797585162