#P9902. Do You Like Interactive Problems?

Do You Like Interactive Problems?

Do You Like Interactive Problems?

Problem Description

There is an integer xx satisfying 1xn1\le x\le n. You know nn but you don't know xx. You can do the following guessing: pick an random integer yy uniformly satisfying 1yn1\le y\le n (your yy may equal to previous queries), and you will be told if x<yx< y, x>yx> y or x=yx=y. You will stop asking if there is only one possible xx satisfying all the conditions. Given nn, if xx is picked randomly uniformly, what's your expected number of queries?

Input

The first line contains an integer TT (1T1001\le T\le 100) denoting the number of test cases. For each test case, the only line contains an integer nn (1n1091\le n\le 10^9).

Output

For each test case, output one integer denoting the expected number of queries modulo 998244353998244353. Formally, it can be proven that the sought expected value can be represented as an irreducible fraction p/qp/q which satisfies q≢0mod998244353q\not\equiv 0\bmod{998244353}, and there is a unique integer rr satisfies 0r<9982443530\le r<998244353 and qrpmod998244353qr\equiv p\bmod{998244353}. Find this rr.

Sample Input

2
1
2

Sample Output

0
1

Source

2023“钉耙编程”中国大学生算法设计超级联赛(10)