#K70792. Factorial Ways

    ID: 33387 Type: Default 1000ms 256MiB

Factorial Ways

Factorial Ways

You are given an integer T representing the number of test cases. For each test case, you are given an integer n which represents the number of blocks. Your task is to compute the number of ways to arrange these blocks. The answer is defined as the factorial of n computed modulo \(10^9+7\).

The factorial function is defined as:

[ n! = \prod_{i=1}^{n} i, \quad \text{with } 0! = 1,]

You should output the result for each test case on a separate line.

inputFormat

The input is given via standard input (stdin) in the following format:

T
n1
n2
...
nT

Where:

  • T is the number of test cases.
  • ni is the number of blocks for the i-th test case.

outputFormat

For each test case, output a single integer representing \(n! \mod (10^9+7)\) on a separate line via standard output (stdout).

## sample
2
6
3
720

6

</p>