atcoder#ARC134F. [ARC134F] Flipping Coins

[ARC134F] Flipping Coins

Score : 10001000 points

Problem Statement

There are NN coins numbered 1,2,,N1, 2, \ldots, N arranged in a row. Initially, all coins face up.

Snuke chooses a permutation pp of (1,,N)(1,\ldots,N) with equal probability, and do NN operations. The ii-th operation does the following.

  • If the coin numbered ii faces down, do nothing.
  • If the coin numbered ii faces up, turn that coin over and then turn over the coin numbered pip_i.

After the NN operations, Snuke will receive WkW^k yen (Japanese currency) from his mother, where kk is the number of coins facing up.

Find the expected value of the amount Snuke will get, multiplied by N!N! (it can be proved that this is an integer), modulo 998244353998244353.

Constraints

  • All values in input are integers.
  • 1N2×1051 \leq N \leq 2 \times 10^5
  • 1W<9982443531 \leq W < 998244353

Input

Input is given from Standard Input in the following format:

NN WW

Output

Print the expected value of the amount Snuke will get, multiplied by N!N!, modulo 998244353998244353.

4 2
90
  • When p=(1,4,2,3)p=(1,4,2,3), the operations go as follows.- In the 11-st operation, the coin numbered 11 faces down, and then the coin numbered 11 faces up.
    • In the 22-nd operation, the coin numbered 22 faces down, and then the coin numbered 44 faces down.
    • In the 33-rd operation, the coin numbered 33 faces down, and then the coin numbered 22 faces up.
    • In the 44-th operation, nothing is done.
  • In the 11-st operation, the coin numbered 11 faces down, and then the coin numbered 11 faces up.
  • In the 22-nd operation, the coin numbered 22 faces down, and then the coin numbered 44 faces down.
  • In the 33-rd operation, the coin numbered 33 faces down, and then the coin numbered 22 faces up.
  • In the 44-th operation, nothing is done.
  • In the end, two coins face up, so he receives 44 yen.
2 100
10001
200000 12345
541410753
  • Be sure to find the value modulo 998244353998244353.