#abc307e. [abc307_e]Distinct Adjacent

[abc307_e]Distinct Adjacent

Problem Statement

There are NN people numbered from 11 to NN standing in a circle. Person 11 is to the right of person 22, person 22 is to the right of person 33, ..., and person NN is to the right of person 11.

We will give each of the NN people an integer between 00 and M1M-1, inclusive.
Among the MNM^N ways to distribute integers, find the number, modulo 998244353998244353, of such ways that no two adjacent people have the same integer.

Constraints

  • 2leqN,Mleq1062 \\leq N,M \\leq 10^6
  • NN and MM are integers.

Input

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

NN MM

Output

Print the answer.


Sample Input 1

3 3

Sample Output 1

6

There are six desired ways, where the integers given to persons 1,2,31,2,3 are (0,1,2),(0,2,1),(1,0,2),(1,2,0),(2,0,1),(2,1,0)(0,1,2),(0,2,1),(1,0,2),(1,2,0),(2,0,1),(2,1,0).


Sample Input 2

4 2

Sample Output 2

2

There are two desired ways, where the integers given to persons 1,2,3,41,2,3,4 are (0,1,0,1),(1,0,1,0)(0,1,0,1),(1,0,1,0).


Sample Input 3

987654 456789

Sample Output 3

778634319

Be sure to find the number modulo 998244353998244353.