{"raw_statement":[{"iden":"problem statement","content":"Find the number of sequences that satisfy all of the conditions below, modulo $998244353$.\n\n*   The length is $N$.\n*   Each of the elements is an integer between $1$ and $M$ (inclusive).\n*   Its longest increasing subsequence has the length of exactly $3$."},{"iden":"notes","content":"A **subsequence** of a sequence is the result of removing zero or more elements from it and concatenating the remaining elements without changing the order. For example, $(10,30)$ is a subsequence of $(10,20,30)$, while $(20,10)$ is not a subsequence of $(10,20,30)$.\nA **longest increasing subsequence** of a sequence is its **strictly** increasing subsequence with the greatest length."},{"iden":"constraints","content":"*   $3 \\leq N \\leq 1000$\n*   $3 \\leq M \\leq 10$\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$ $M$"},{"iden":"sample input 1","content":"4 5"},{"iden":"sample output 1","content":"135\n\nOne sequence that satisfies the conditions is $(3,4,1,5)$.  \nOn the other hand, $(4,4,1,5)$ do not, because its longest increasing subsequence has the length of $2$."},{"iden":"sample input 2","content":"3 4"},{"iden":"sample output 2","content":"4"},{"iden":"sample input 3","content":"111 3"},{"iden":"sample output 3","content":"144980434\n\nFind the count modulo $998244353$."}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}