P21483 [HackerEarth] For a given prime number p find all the number of pairs (m, n) of positive integers such that 1 ≤ m , n ≤ p(p-1)* and p divides nm - mn. Output the result modulo 1000000007.
普及
题目描述

For a given prime number p find all the number of pairs (m, n) of positive integers such that 1 ≤ m , n ≤ p(p-1)* and p divides nm - mn. Output the result modulo 1000000007.

INPUT

The first line contains a single positive integer T ≤ 100, the number of test cases. T test cases follow. The only line of each test case contains a prime number p , where 2 ≤ p ≤ 10^12.

OUTPUT

For each test case, output a single line containing the answer for the corresponding test case.

SAMPLE INPUT
1
3

SAMPLE OUTPUT
14

Explanation

Required pairs are (1, 1), (1, 4), (2, 2), (2, 4), (3, 3), (3, 6), (4, 1), (4, 2), (4, 4), (4, 5), (5, 4), (5, 5), (6, 3) and (6, 6).

输入格式

见题面

输出格式

见题面

样例输入
13 2 3 5 7 11 13 17 19 23 29 31 37 41
样例输出
2 14 104 366 1550 3048 6272 9774 14894 34664 48750 84456 108320 24937543 901030760 855370734 804566126 54572257 738054254 54532321 910712096 119658247 803226254 145736161 257787513 268145767 872126126 144469159 314390343 348994567 226637817 637434649 353252193