Nobody Gets Their Own Hat
n guests check their hats at the door. At the end of the party the cloakroom attendant hands the hats back in a uniformly random order — one hat per guest, each hat used exactly once.
A return order is perfect chaos if no guest receives their own hat, i.e. the hats come back according to a permutation of the n guests with no fixed point.
For each of q independent parties, you are told the number of guests n. Count how many perfect-chaos return orders are possible, modulo 1 000 000 007.
By convention, with 0 guests there is exactly one (empty) way to return hats, and it counts as perfect chaos; with 1 guest the single hat must return to its only owner, so there are 0 perfect-chaos orders.
Input
The first line contains a single integer q (1 ≤ q ≤ 10^5), the number of parties.
Each of the next q lines contains a single integer n (0 ≤ n ≤ 10^6), the number of guests at that party.
Output
For each party, print one line with a single integer: the number of permutations of the n hats with no fixed point, modulo 1 000 000 007.
Notes
In the first example, with n = 3 guests the permutations with no fixed point are (2,3,1) and (3,1,2), so the answer is 2. With n = 4 there are 9 such permutations.