Distinct Words

5

2 votes
Easy
Problem

Given N distinct characters, How many distinct n letter words can be formed.

Constraints :
For 60 Points : 

1 ≤ T  ≤ 103
1 ≤ N ≤ 103

For 40 Points : 
1 ≤ T  ≤ 105
1 ≤ N ≤ 105

Input :

First Line contains T number of test case.
Each of the next T lines contain an Integer N.

Output :

For each test case print number of distinct n letter words mod 109+7 in a new line.

Time Limit: 1
Memory Limit: 256
Source Limit:
Editor Image

?