Score : $600$ points
For a sequence $A$ of length $N$ consisting of integers between $1$ and $M$ (inclusive), let us define $f(A)$ as follows:
Find the sum, modulo $998244353$, of $f(A)$ over all $M^N$ sequences that can be $A$.
Input is given from Standard Input in the following format:
$N$ $M$
Print the sum of $f(A)$ over all sequences $A$, modulo $998244353$.
2 3
15
The $3 ^ 2 = 9$ sequences and the value of $f$ for those are as follows:
The sum of these values is $3 \times 1 + 6 \times 2 = 15$.
3 2
15
34 56
649717324