#P4834. 萨塔尼亚的期末考试

萨塔尼亚的期末考试

Description

This problem is as follows:

There is an electric field formed by nn point charges. Assume each point charge produces a uniform electric field rather than a point-charge field, and the ii-th point charge has field strength Ei=iE_i=i.

Now place a negatively charged test charge in this field. As soon as the test charge touches any point charge, it will "fuse" with that point charge and release a huge amount of energy.

Because the field strengths produced by the point charges differ, the test charge is attracted to each point charge with different force; the stronger the attraction a point charge exerts on the test charge, the greater the probability of being drawn to that point charge, and the probability is proportional to the attraction.

Assume the smallest point charge exerts attraction FF on the test charge. Then another point charge exerts iFiF. Suppose the probability of touching the smallest point charge is PP. Then the probability for each point is iPiP. After touching a point charge, the released energy is Fib(Ei)\mathrm{Fib}(E_i).

Find the expected released energy.

The good news is that as long as she gets points on this problem, Satania will pass!

Input Format

The first line contains an integer TT, the number of test cases.

Each of the next TT lines contains an integer nn, the number of point charges.

Output Format

For each query, output one integer representing the expected energy. To avoid precision issues, please output the answer modulo 998,244,353998{,}244{,}353.

1
2

1

Hint

  • Sample Explanation

$\dfrac{1}{3}\times \mathrm{Fib}(1)+\dfrac{2}{3}\times \mathrm{Fib}(2)=1$.

Please read the problem carefully along with the sample.

  • Constraints

  • For 10%10\% of the testdata, T=1T=1, n=2n=2.

  • For 30%30\% of the testdata, T10T \le 10, 1n1061 \le n \le 10^6.

  • For 60%60\% of the testdata, T106T \le 10^6, 1n1061 \le n \le 10^6.

  • For 100%100\% of the testdata, T106T \le 10^6, 1n1091 \le n \le 10^9, and it is guaranteed that n998244352n \ne 998244352 and n998244353n \ne 998244353.

Fib(i)\mathrm{Fib}(i) is the Fibonacci sequence.

$$\mathrm{Fib}(i)=\begin{cases} 1 & i\le 2 \cr \mathrm{Fib}(i-1)+\mathrm{Fib}(i-2) & i > 2 \end{cases}$$

Translated by ChatGPT 5