Chef is interested to solve series problems. Chef wants to solve a series problem but he can't 
solve it till now.Can you help Chef to solve the series problem?
- In series problem, the series goes as follows 1,9,31,73,141 . . . . . . . . 
Your task is to find the Nth term of series. For larger value of $N$ answer becomes very large, So your output should be performed $N$th term modulo 1000000007 ($10^9+7$ ).
-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- Each testcase contains of a single integer $N$. 
-----Output:-----
For each testcase,  output in a single line answer i.e. The $N$th term of series modulo 1000000007.
-----Constraints-----
- $1 \leq T \leq 10^5$
- $1 \leq N \leq 10^9$
-----Sample Input:-----
2
8
10
-----Sample Output:-----
561
1081
# cook your dish here
for u in range(int(input())):
 n=int(input())
 s=(n-1)**2+n**3
 print(s%(10**9+7))

# cook your dish here
for u in range(int(input())):
 n=int(input())
 s=(n-1)**2+n**3
 print(s%(10**9+7))
