Adnan is going to organize a chess tournament. He has invited players to participate. Each pair of players will play at most one game against each other. All the players will be happy if everyone can participate in at least one game. You want to arrange some games such that everyone becomes happy. Can you help him to calculate the number of ways to select the games? Output the answer modulo .
A game between two players and is denoted by . Two ways of selecting the games are different if they differ in at least one game. Formally, if the set of selected games of the first way is and the set of selected games of the second way is then two ways are different if . The game denoted by and are same.
The first line of input contains a single integer the number of test cases.
Each of the next lines contains a single integer the number of invited players.
For each test case, print the number of ways modulo in a single line.
Input | Output |
---|---|
5 1 2 3 5 10 | 0 1 4 768 11652982 |
For, , there are valid ways: Here, all the sets are different and everyone participated in at least one game in each of the ways of arrangement. |