#P4981. 父子

父子

Description

In male dorms across the country, there are always all kinds of messy “father-son” relationships.

Now suppose a dorm has nn different people. Each person has at most one “dad”, can have multiple “sons”, and there is exactly one person who has no “dad” (after all, they are the dorm leader, so give them some respect; of course, anyone can be the leader).

Now the question is: for a dorm with nn people, what is the maximum possible number of different father-son relationships? Also, between any two people, there must be a direct or indirect father-son relationship.

Input Format

The first line contains a non-negative integer tt, meaning there are tt test cases.

The next tt lines each contain an integer nn, meaning there are nn people.

Output Format

Output tt lines. Each line contains one integer, the number of possible relationships.

Since the answer may be large, output the result modulo 109+910^9+9.

1
3

9
1
323

283888610

Hint

  • For 10%10\% of the testdata, it is guaranteed that t=0t=0.

  • For another 30%30\% of the testdata, it is guaranteed that n5n \le 5.

  • For 100%100\% of the testdata, t104t \le 10^4, 1n1091 \le n \le 10^9.

Translated by ChatGPT 5