#P5615. [MtOI2019] 时间跳跃
[MtOI2019] 时间跳跃
Background
Even if you know the method, you must never change the past. You must never turn a possible existence into a fixed reality. No one can predict the future, and it cannot be redone. Precisely because of this, people can accept all kinds of pain, misfortune, and sudden disasters, and keep moving forward.

Problem Description
For some reason, Rintaro owes Mayuri one banana.
To shut Mayuri up, Rintaro makes a deal with Mayuri: as long as Mayuri answers this question correctly, Mayuri can have as many bananas as she wants:
There are secret passages in the mechanism. The length of the -th secret passage is . The mechanism will randomly choose some secret passages from the possible selection plans with equal probability. If the selected secret passages can form a convex polygon, then the weight of this plan is the number of selected secret passages; otherwise, the weight is .
Now please compute the expected value of the weight of the selected secret passages modulo . (Two selection plans are different if and only if there exists a secret passage that is selected in one plan but not selected in the other. Note that the empty set is also a plan.)
Kurisu: Then isn’t this just...
Rintaro: Assistant, shut up!
Mayuri drew and drew on the paper, but ended up drawing nothing. So Mayuri can only ask you for help.
Input Format
The input has lines in total.
The first line contains a positive integer , meaning there are queries.
The next lines each contain one positive integer, representing for this query.
Output Format
Your output should contain exactly lines. The -th line contains a non-negative integer representing the expected value for the query modulo .
5
1
2
3
4
5
0
0
0
937500007
562500005
Hint
Sample Explanation 1
It is easy to see that when is less than or equal to , it is impossible to form a valid polygon.
When , the following sets of chosen side lengths have non-zero weight:
, .
The answer is .
When , the following sets of chosen side lengths have non-zero weight:
, , ,
, , , , .
The answer is .
Subtasks
This problem uses bundled testdata.
For of the data, , .
There are subtasks in total. The score and limits of each subtask are as follows:
Subtask ( points): .
Subtask ( points): .
Subtask ( points): .
Subtask ( points): .
Subtask ( points): no special restrictions.
Source
Problem setter: CYJian
Checker: suwAKow
Translated by ChatGPT 5