题目描述
Find the number of sequences that satisfy all of the conditions below, modulo $998244353$.
- The length is $N$.
- Each of the elements is an integer between $1$ and $M$ (inclusive).
- Its longest increasing subsequence has the length of exactly $3$.
### Constraints
- $3 \leq N \leq 1000$
- $3 \leq M \leq 10$
- All values in input are integers.