{"raw_statement":[{"iden":"problem statement","content":"You are given positive integers $N$ and $K$ satisfying $1\\leq K\\leq N$.\nFor a permutation $P = (P_{1}, P_{2}, \\dots , P_{N})$ of $(1, 2, \\dots , N)$, define $f(P)$ as follows:\n\n*   The minimum possible value of the number of inversions of a length-$N$ integer sequence $A = (A_{1}, A_{2}, \\dots, A_{N})$ satisfying the following condition:\n    *   $|A_{i}| = P_{i}$ for every integer $1\\leq i\\leq N$.\n\nFor $a = 1, 2, \\dots, N$, answer the following question:\n\n> There are $(N - 1)!$ permutations $P = (P_{1}, P_{2}, \\dots , P_{N})$ of $(1, 2, \\dots , N)$ satisfying $P_{K} = a$. Find the sum, modulo $998244353$, of $f(P)$ over all of them."},{"iden":"constraints","content":"*   $1\\leq K\\leq N\\leq 2\\times 10^{5}$\n*   All input values are integers."},{"iden":"input","content":"The input is given from Standard Input in the following format:\n\n$N$ $K$"},{"iden":"sample input 1","content":"4 2"},{"iden":"sample output 1","content":"3\n3\n6\n8"},{"iden":"sample input 2","content":"1 1"},{"iden":"sample output 2","content":"0"},{"iden":"sample input 3","content":"16 7"},{"iden":"sample output 3","content":"262718137\n262718137\n826158422\n869037161\n443336358\n897729892\n154945392\n124681723\n861272045\n3176021\n900143166\n451899023\n365015181\n740245202\n732524873\n391198612"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}