#C8958. Magical Sequences

    ID: 52997 Type: Default 1000ms 256MiB

Magical Sequences

Magical Sequences

In this problem, you are required to compute the number of magical sequences of a given length \(N\). A magical sequence is defined by its number of distinct arrangements, which is given by the factorial of \(N\) (i.e., \(N!\)). Since the number can be very large, you are asked to output the result modulo \(10^9+7\).

Formally, the answer for each test case is calculated as:
\( result = N! \mod (10^9+7) \)

inputFormat

The input is read from standard input (stdin). The first line contains an integer (T), denoting the number of test cases. Each of the following (T) lines contains an integer (N), representing the length of the magical sequence.

outputFormat

For each test case, output the number of magical sequences modulo (10^9+7) on a new line to standard output (stdout).## sample

1
3
6

</p>