Saki is cleaning up the data obtained from false minoshiro she has captured. The data consists of all non-negative integer sequences of length equal to $$$N$$$, where each integer is less than $$$M$$$.
For a sequence $$$s$$$ in the data, we write $$$s=[s_0, \cdots, s_{N-1}]$$$ where $$$s_i$$$ is the $$$i$$$-th integer in $$$s$$$.
Let $$$\pi(s)$$$ be the length of the longest proper prefix that is also a proper suffix. i.e. it is the maximum non-negative integer $$$p$$$ with $$$p \lt N$$$ such that $$$s_i = s_{N-(p-i)}$$$ for all integer $$$0 \le i \lt p$$$. Note that the maximum always exist as $$$p=0$$$ satisfies the condition. When Saki cleans up sequence $$$s$$$, she saves $$$\pi(s)^2$$$ amount of effort.
Saki now wants to know the sum of all efforts she will save when she cleans up the entire data. Write a program to find the sum, modulo $$$998\,244\,353$$$.
The input is given in the following format:
| $$$N$$$ | $$$M$$$ |
where $$$N$$$ is the length of a sequence, and $$$M$$$ is the upper bound of the size of an element in a sequence plus one.
The input satisfies the following constraints:
Print a single line containing the sum of all efforts Saki will save when cleaning up the data, modulo $$$998\,244\,353$$$.
1 2
0
5 3
264