#P1992G. Ultra-Meow

Ultra-Meow

Description

K1o0n gave you an array aa of length nn, consisting of numbers 1,2,,n1, 2, \ldots, n. Accept it? Of course! But what to do with it? Of course, calculate MEOW(a)\text{MEOW}(a).

Let MEX(S,k)\text{MEX}(S, k) be the kk-th positive (strictly greater than zero) integer in ascending order that is not present in the set SS. Denote MEOW(a)\text{MEOW}(a) as the sum of MEX(b,b+1)\text{MEX}(b, |b| + 1), over all distinct subsets bb of the array aa.

Examples of MEX(S,k)\text{MEX}(S, k) values for sets:

  • MEX({3,2},1)=1\text{MEX}(\{3,2\}, 1) = 1, because 11 is the first positive integer not present in the set;
  • MEX({4,2,1},2)=5\text{MEX}(\{4,2,1\}, 2) = 5, because the first two positive integers not present in the set are 33 and 55;
  • MEX({},4)=4\text{MEX}(\{\}, 4) = 4, because there are no numbers in the empty set, so the first 44 positive integers not present in it are 1,2,3,41, 2, 3, 4.

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases.

In a single line of each test case, an integer nn (1n50001 \le n \le 5000) is entered, the size of the array of gifted numbers.

It is guaranteed that the sum of n2n^2 over all test cases does not exceed 2510625 \cdot 10^6.

For each test case, output a single number — MEOW(a)\text{MEOW}(a). Since it may be very large, output it modulo 109+710^9 + 7.

Input

The first line contains a single integer tt (1t1041 \le t \le 10^4) — the number of test cases.

In a single line of each test case, an integer nn (1n50001 \le n \le 5000) is entered, the size of the array of gifted numbers.

It is guaranteed that the sum of n2n^2 over all test cases does not exceed 2510625 \cdot 10^6.

Output

For each test case, output a single number — MEOW(a)\text{MEOW}(a). Since it may be very large, output it modulo 109+710^9 + 7.

Sample Input 1

5
2
3
4999
5
1

Sample Output 1

12
31
354226409
184
4