样例输入 1
样例输出 1
样例解释 1
在所有 n!n!n! 种排列中共有 444 个三元简单环({1,3,2},{2,3,1},{2,1,3},{3,1,2}\{1,3,2\},\{2,3,1\},\{2,1,3\},\{3,1,2\}{1,3,2},{2,3,1},{2,1,3},{3,1,2} 各一个),所以答案为 43!=23\frac{4}{3!}=\frac{2}{3}3!4=32,即 2×3−1(mod998244353)=665496236。
样例输入 2
样例输出 2
Sample Input 1
Sample Output 1
Sample Explanation 1
It is easy to count that there are four 333-cycles in total from the 3!3!3! permutations(each of {1,3,2},{2,3,1},{2,1,3},{3,1,2}\{1,3,2\},\{2,3,1\},\{2,1,3\},\{3,1,2\}{1,3,2},{2,3,1},{2,1,3},{3,1,2} has one). So answer is 43!=23\frac{4}{3!}=\frac{2}{3}3!4=32,that is, 2×3−1(mod998244353)=665496236.
Sample Input 2
Sample Output 2