Jackson House


  • محدودیت زمان: ۱ ثانیه
  • محدودیت حافظه: ۲۵۶ مگابایت

Jackson, after witnessing the advancements in the world of technology, decided to sell his small cozy house and enroll in the programming-and-algorithm micromaster. He came across an interesting algorithm that he needed to analyze and solve the problem related to it, in order to pass the exam at this stage of the course. The pseudocode of this algorithm is as follows:

توضیح تصویر

He wants to know for how many permutations π\pi of length nn from the possible n!n! ones, the final permutation will be sorted after running this algorithm.

ورودی🔗

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

Each of the next tt lines contains an integer nin_i, representing the length of the permutation for the ithi^{th} test case.

1t1001 \leq t \leq 100 2ni1092 \leq n_i \leq 109

خروجی🔗

Output tt lines. On the ithi^{th} line, print the number of permutations of length nin_i which will be sorted after running the provided algorithm on it. Since the output could be very large, output the result modulo 109+710^9 + 7.

مثال🔗

ورودی نمونه ۱🔗

4
3
5
10
20
Plain text

خروجی نمونه ۱🔗

4
16
1728
23887872
Plain text