Bubble Sort
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 64 M,其他语言128 M
64bit IO Format: %lld

题目描述

Do you know bubble sort algorithm? It's one of the most famous sorting algorithms.

The bubble sort algorithm is stable, which can be described below:



It's easy for us to find that we need swap  times in the worst case, so the total swapping count is about , where n is the length of the given sequence.

But the above result is an approximate result. As a curious student, Ramen is wondering, among all permutations of length n, what the value of the average exact swap count is?

输入描述:

The input contains multiple test cases.

The first line is an integer T(1 <= T <= 10000), which indicates represents the number of test cases.

Each of the next T lines contains an integer n(1 <= n <= 1e18), represents the length of the permutation.

输出描述:

For each test case, output the average swap count in one single line.

To avoid possible errors, if the answer is , you need to output , i.e., , where  is the minimum number that suits
示例1

输入

复制
3
1
3
1000000000000000000

输出

复制
0
499122178
178803651

说明

For n=3, all the permutations and these swap count are:
* [1,2,3] \to 0
* [1,3,2] \to 1
* [2,1,3] \to 1
* [2,3,1] \to 2
* [3,1,2] \to 2
* [3,2,1] \to 3
So the answer is \displaystyle{\frac{0+1+1+2+2+3}{6}}\equiv9\times6^{-1}\equiv499122178 \pmod{998244353}.