Jackson House | 프로그래밍의 벗 PivotOJ
PivotOJ

Jackson House

시간 제한: 1000ms메모리 제한: 2048MB출처: ICPC Asia Tehran Regional Contest 2023BOJ 33184

문제

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:

input: a permutation &pi; = <&pi;_1, &pi;_2, \dots , &pi;_n> of numbers {1,2,,n}\{1, 2, \dots , n\}
while &pi; is changing during this iteration:
    for i:=ni := n downto 22:
        if &pi;_i < &pi;_{\lfloor i/2 \rfloor}:
            swap(&pi;_i, &pi;_{\lfloor i/2 \rfloor})

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 (1t1001 \le t \le 100), the number of test cases.

Each of the next tt lines contains an integer nin_i (2ni1092 \le n_i \le 10^9), representing the length of the permutation for the iith test case.

출력

Output tt lines. On the iith 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.

예제

예제 1

입력
4
3
5
10
20
출력
4
16
1728
23887872
코드를 제출하려면 로그인하세요.