#d2851. Good Permutations

Good Permutations

Good Permutations

Problem Description

For every permutation aa of length nn, we can build a graph from it in the following two ways:

  1. For each 1≤i≤n1 \le i \le n, find the largest jj with 1≤j<i1 \le j < i and aj>aia_j > a_i, and add an undirected edge between ii and jj.
  2. For each 1≤i≤n1 \le i \le n, find the smallest jj with i<j≤ni < j \le n and aj>aia_j > a_i, and add an undirected edge between ii and jj.

Note that the edges are built between the corresponding indices i,ji, j.

How many permutations aa of length nn are there such that the resulting graph contains a cycle?

The number of permutations may be very large; output it modulo 109+710^9 + 7.

Input Format

The first line gives one integer TT (1≤T≤1051 \le T \le 10^5), the number of test cases.

Lines 22 to T+1T + 1 each give one integer nn (3≤n≤1063 \le n \le 10^6), the length of the permutation.

Output Format

Output, modulo 109+710^9 + 7, the number of permutations satisfying the condition.

Sample Input

1
4

Sample Output

16