#!/bin/python3

import os
import sys

#
# Complete the summingSeries function below.
#

'''
Tn = n^2 - (n - 1)^2 = 2n - 1
Sn = T1 + T2 + ... + Tn
  = Σ(2n - 1)
  = 2Σn - n
  = 2*(n(n+1)/2) - n
  = n*n
'''
def summingSeries(n):
    #
    # Write your code here.
    #

    return (n*n)%1000000007

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    t = int(input())

    for t_itr in range(t):
        n = int(input())

        result = summingSeries(n)

        fptr.write(str(result) + '\n')

    fptr.close()
