Moser's Circle Problem

Time limit: 0.05s Memory limit: 128MB Input: Output:

Task

Consider a circle. On the circle, NN arbitrary points are designated. If lines are drawn between all pairs of points, what is the maximum number of pieces into which the circle can be decomposed? Answer QQ such scenarios.

Input data

The program reads the number QQ from standard input and on each of the next QQ lines reads a number NN, representing the number of points in the respective scenario.

Output data

On the next QQ lines, the program will print the answers for each scenario to standard output, modulo 1 000 000 0071 \ 000 \ 000 \ 007.

Restrictions and specifications

  • It is recommended to use fastio.
  • 1Q100 0001 \leq Q \leq 100 \ 000
  • 1N1 000 000 0001 \leq N \leq 1 \ 000 \ 000 \ 000
  • For 25 points, Q5 000Q \leq 5 \ 000, N5 000N \leq 5 \ 000.
  • For another 50 points, Q100 000Q \leq 100 \ 000, N1 000 000N \leq 1 \ 000 \ 000.
  • Since the answer can be very large, it will be displayed modulo 1 000 000 0071 \ 000 \ 000 \ 007.

Example

stdin

6
1
2
3
4
5
6

stdout

1
2
4
8
16
31

Explanation

For the fourth scenario, one of the possible optimal arrangements of the 44 points is as follows:

Log in or sign up to be able to send submissions!