There is a sequence whose $n^{\text{th}}$ term is 

$T_n=n^2-(n-1)^2$  

Evaluate the series 

$S_n=T_1+T_2+T_3+\cdots+T_n$ 

Find $S_n\:\text{mod}\:(10^9+7)$.  

Example  

$n=3$  

The series is $1^2-0^2+2^2-1^2+3^2-2^2=1+3+5=9$.  

Function Description  

Complete the summingSeries function in the editor below.  

summingSeries has the following parameter(s):  

int n: the inclusive limit of the range to sum  

Returns  

int: the sum of the sequence, modulo $(10^9+7)$  

Input Format

The first line of input contains $\boldsymbol{\boldsymbol{t}}$, the number of test cases. 

Each test case consists of one line containing a single integer $n$.  

Constraints

$1\leq t\leq10$  
$1\leq n\leq10^{16}$  

Sample Input 0
2
2
1

Sample Output 0
4
1

Explanation 0

Case 1: We have $4=1+3$ 

Case 2: We have $1=1$

Difficulty: MEDIUM
Tags: Mathematics

Starter code:

Solutions:
t = int(input())
while t:
	t -= 1
	n = int(input())
	print(pow(n, 2, 1000000007))


T = int(input())
for _ in range(T):
	n = int(input())
	print(n * n % 1000000007)


mod = 1000000007
T = int(input())
for t in range(T):
	n = int(input())
	print(n * n % mod)


t = int(input())
mod = 10 ** 9 + 7
for i in range(t):
	n = int(input())
	print(n ** 2 % mod)


def modfun(a, b, c):
	x = 1
	y = a
	while b > 0:
		if b % 2 == 0:
			x = y * y % c
			b /= 2
		else:
			y = x * y % c
			b -= 1
	return x % c
t = int(input())
s = 0
for i in range(0, t):
	n = int(input())
	s = modfun(n, 2, 1000000007)
	print(s)


readints = lambda : map(int, input().split())
mod = 10 ** 9 + 7
T = int(input())
while T > 0:
	n = int(input())
	print(n * n % mod)
	T -= 1


import sys
MOD = 1000000007
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	print(pow(n, 2, MOD))


t = int(input())
for i in range(t):
	n = int(input())
	print(n ** 2 % (10 ** 9 + 7))


T = int(input())
for t in range(T):
	inp = int(input())
	print(inp ** 2 % (10 ** 9 + 7))


m = 10 ** 9 + 7
t = int(input())
for i in range(t):
	n = int(input())
	ans = n * n % m
	print(str(ans))


mod = 1000000007

def kmult(x, y):
	if min(x, y) < 1000:
		return x * y
	m = half_ceil(degree(max(x, y)))
	(x1, x0) = decompose(x, m)
	(y1, y0) = decompose(y, m)
	z2 = kmult(x1, y1)
	z0 = kmult(x0, y0)
	z1 = kmult(x1 + x0, y1 + y0) - z2 - z0
	xy = z2 * 10 ** (2 * m) + z1 * 10 ** m + z0
	return xy

def decompose(x, m):
	return (x // 10 ** m, x % 10 ** m)

def degree(x):
	return len(str(x))

def half_ceil(n):
	return n // 2 + (n & 1)
t = int(input())
for i in range(t):
	n = int(input())
	print(kmult(n, n) % mod)


t = int(input())
c = 0
while t > c:
	n = int(input())
	print(pow(n, 2, 1000000000 + 7))
	c += 1


import sys
import math

def n_series(number):
	(q, r) = divmod(pow(number, 2), pow(10, 9) + 7)
	return r
test_case = int(input())
for i in range(test_case):
	number = int(input())
	ret = n_series(number)
	print(ret)


for bita3 in range(int(input())):
	x = int(input())
	print(x * x % 1000000007)


n = int(input())
for i in range(n):
	x = int(input())
	print(x * x % 1000000007)


T = int(input())
while T:
	print(int(input()) ** 2 % (10 ** 9 + 7))
	T -= 1


for T in range(int(input())):
	print(int(input()) ** 2 % 1000000007)


tests = int(input())
ns = []
mod = 10 ** 9 + 7
for i in range(tests):
	ns.append(int(input()))
for n in ns:
	print(n * n % mod)


T = int(input())
for t in range(T):
	n = int(input())
	print(pow(n, 2, 10 ** 9 + 7))


for i in range(int(input())):
	print((int(input()) % int(7 + 1000000000.0)) ** 2 % int(7 + 1000000000.0))


t = int(input())
a = int(1000000000.0) + 7
while t:
	t -= 1
	n = int(input())
	r = n % a * (n % a) % a
	print(r)


import sys
step = 0
results = []
for line in sys.stdin:
	if step > 0:
		number = int(line)
		results.append(str(number ** 2 % (10 ** 9 + 7)))
	step += 1
print('\n'.join(results))


m = 1000000007
for t in range(int(input())):
	print(pow(int(input()), 2, m))


T = int(input())
for _ in range(T):
	N = int(input())
	print(N ** 2 % (10 ** 9 + 7))


cases = int(input())
for case in range(cases):
	n = int(input())
	print(pow(n, 2, 10 ** 9 + 7))


import sys
MOD = 1000000007
T = int(sys.stdin.readline())
for _ in range(T):
	n = int(sys.stdin.readline())
	print(pow(n, 2, MOD))


T = int(input())
for t in range(T):
	n = int(input())
	sq_value = n * n % (10 ** 9 + 7)
	print(sq_value)


for i in range(int(input())):
	print(int(input()) ** 2 % (10 ** 9 + 7))


def prog():
	for i in range(int(input())):
		print(int(input()) ** 2 % (10 ** 9 + 7))
prog()


t = int(input())
l = []
for i in range(t):
	x = int(input())
	l.append(x)
for x in range(len(l)):
	l[x] = l[x] ** 2 % (10 ** 9 + 7)
for i in l:
	print(i)


a = int(input())
for i in range(0, a):
	n = int(input())
	print(n * n % 1000000007)


MOD = 10 ** 9 + 7
T = int(input())
for t in range(T):
	n = int(input())
	print(pow(n, 2, MOD))


tc = int(input())
for i in range(tc):
	n = int(input())
	print(n ** 2 % 1000000007)


for t in range(int(input())):
	n = int(input())
	print(n ** 2 % (10 ** 9 + 7))


T = int(input())
for _ in range(T):
	n = int(input())
	print(n ** 2 % 1000000007)


import re
import sys
max = int(input())
i = 1
while i <= max:
	val = int(input())
	val = val % 1000000007
	val = pow(val, 2)
	val = val % 1000000007
	print(val)
	i = i + 1


t = int(input())
for i in range(t):
	n = int(input())
	print(n ** 2 % (10 ** 9 + 7))


test_cases = int(input())
for i in range(test_cases):
	number = int(input())
	print(pow(number, 2, 10 ** 9 + 7))


T = input()
T = int(T)
while T >= 1:
	n = input()
	n = int(n)
	print(n * n % (10 ** 9 + 7))
	T -= 1


test_cases = int(input())
while test_cases > 0:
	test_cases -= 1
	print(int(input()) ** 2 % (10 ** 9 + 7))


N = int(input())
for i in range(0, N):
	tmp = int(input().strip())
	print(tmp * tmp % 1000000007)


for case in range(int(input())):
	print(int(input()) ** 2 % (10 ** 9 + 7))


import sys

def fast_pow(a, b):
	ans = 1
	while b > 0:
		if b & 1:
			ans = ans * a % (10 ** 9 + 7)
		a = a * a % (10 ** 9 + 7)
		b >>= 1
	return ans
test = int(input())
for i in range(test):
	n = int(input())
	print(fast_pow(n, 2))


for _ in range(int(input())):
	print(int(input()) ** 2 % (10 ** 9 + 7))


for i in range(int(input())):
	print(int(input()) ** 2 % (10 ** 9 + 7))


for i in range(int(input())):
	print(int(input()) ** 2 % (10 ** 9 + 7))


t = int(input())
assert t <= 10 and t >= 1
for _ in range(t):
	n = int(input())
	assert n <= 10 ** 16 and n >= 1
	print(n ** 2 % (10 ** 9 + 7))


tc = int(input())
while tc != 0:
	num = int(input())
	print(pow(num, 2, 10 ** 9 + 7))
	tc -= 1


c = int(input())
d = pow(10, 9) + 7
for i in range(c):
	e = int(input())
	print(pow(e, 2) % d)


def checkt(z):
	if 1 <= z <= 10:
		return True

def checkn(z):
	if 1 <= z <= 10 ** 16:
		return True
t = int(input())
if checkt(t):
	for i in range(t):
		n = int(input())
		if checkn(n):
			print(n ** 2 % (10 ** 9 + 7))


x = int(input())

def Sn():
	n = int(input())
	Suma = n ** 2
	Sn = Suma % (10 ** 9 + 7)
	return Sn
out = ''
for i in range(0, x):
	out += str(Sn()) + '\n'
print(out)


num = int(input())
for i in range(num):
	n = int(input())
	sum = n * n
	print(sum % (10 ** 9 + 7))


n = int(input())
for i in range(n):
	i = int(input())
	print(i ** 2 % (10 ** 9 + 7))


cases = int(input())
for i in range(cases):
	n = int(input())
	print(n ** 2 % (10 ** 9 + 7))


num_cases = int(input())
for case in range(num_cases):
	n = int(input())
	print(n ** 2 % (10 ** 9 + 7))


t = int(input())
for asdfas in range(t):
	n = int(input())
	result = -n
	result += n * (n + 1)
	if n == 1:
		print(1)
	else:
		print(result % (10 ** 9 + 7))


T = int(input())
MAX = 10 ** 9 + 7
for i in range(T):
	n = int(input())
	print(n * n % MAX)


def inpt():
	return int(input())
num_test_cases = inpt()
mod_value = 10 ** 9 + 7
for i in range(num_test_cases):
	n = inpt()
	print(pow(n, 2, mod_value))


a = int(input())
for x in range(0, a):
	n = int(input())
	o = n ** 2 % 1000000007
	print(o)


cases = int(input())
for i in range(0, cases):
	curr = int(input())
	print(curr * curr % 1000000007)
	i += 1


T = int(input())
while T:
	n = int(input())
	print(n * n % 1000000007)
	T = T - 1


t = int(input())
for i in range(t):
	n = int(input())
	r = n ** 2
	s = r % 1000000007
	print(s)


t = int(input())
for i in range(t):
	n = int(input())
	print(n ** 2 % 1000000007)


t = int(input())
while t != 0:
	n = int(input())
	ans = n * n % (1000000000 + 7)
	print(ans)
	t = t - 1


for i in range(int(input())):
	s = 0
	n = int(input())
	print(n ** 2 % (10 ** 9 + 7))


def ssum(n):
	return n * n % (10 ** 9 + 7)

def main():
	t = int(input())
	while t != 0:
		s = int(input())
		print(ssum(s))
		t -= 1
main()


for t in range(int(input())):
	print(int(input()) ** 2 % 1000000007)


for i in range(int(input())):
	print(int(input()) ** 2 % (10 ** 9 + 7))


for i in range(int(input())):
	print(int(input()) ** 2 % 1000000007)


for i in range(int(input())):
	print(int(input()) ** 2 % 1000000007)


for case in range(int(input())):
	print(int(input()) ** 2 % 1000000007)


for i in range(int(input())):
	print(int(input()) ** 2 % 1000000007)


T = int(input())
for t in range(T):
	print(int(input()) ** 2 % (10 ** 9 + 7))


for i in range(int(input())):
	print(int(input()) ** 2 % 1000000007)


cases = int(input())
for case in range(cases):
	n = int(input())
	last_num = 2 * n - 1
	print(n * (1 + last_num) // 2 % (pow(10, 9) + 7))


y = int(input())
while y:
	x = int(input())
	print(x * x % 1000000007)
	y = y - 1


import sys

def f(n):
	return n ** 2 % (10 ** 9 + 7)

def main():
	t = int(input())
	test_cases = [int(input()) for _ in range(t)]
	for t in test_cases:
		print(f(t))
	return 0
sys.exit(main())


N = int(input())
temp = 10 ** 9 + 7
for i in range(N):
	curr = int(input())
	print(curr * curr % temp)


T = int(input())
for _ in range(T):
	n = int(input())
	print(n * n % (10 ** 9 + 7))


def summation(n):
	return n * n % (10 ** 9 + 7)
testCases = int(input().strip())
while testCases > 0:
	number = int(input().strip()) % (10 ** 9 + 7)
	ans = summation(number)
	print(ans)
	testCases -= 1


t = int(input())
r = [0 for i in range(t)]
for i in range(t):
	n = int(input())
	r[i] = n ** 2 % (10 ** 9 + 7)
for i in range(t):
	print(r[i])


for i in range(int(input())):
	print(int(input()) ** 2 % (10 ** 9 + 7))


M = 10 ** 9 + 7
t = int(input().strip())
for _ in range(t):
	n = int(input().strip())
	print(pow(n, 2, M))


N = int(input())
for i in range(0, N):
	M = int(input())
	print(M * M % 1000000007)


t = int(input())
for T in range(t):
	n = int(input())
	print(n * n % (10 ** 9 + 7))


def process_case():
	n = int(input())
	print(pow(n, 2) % (pow(10, 9) + 7))
num_cases = int(input())
while num_cases > 0:
	process_case()
	num_cases -= 1


import math
x = int(input())
l = []
while x != 0:
	l.append(input())
	x = x - 1
for i in l:
	c = int(i)
	jj = c * c
	final = jj % 1000000007
	print(final)


x = int(input())
for i in range(x):
	l = int(input())
	print(l * l % (10 ** 9 + 7))


_mod = 10 ** 9 + 7
Tn = int(input())
result = []
for i in range(Tn):
	result.append(int(input()))
for i in result:
	ans = i ** 2 % _mod
	print(ans)


a = int(input())
for i in range(a):
	c = int(input())
	c %= 1000000007
	print(c * c % 1000000007)


t = int(input())
for i in range(t):
	n = int(input())
	print(n ** 2 % 1000000007)


def sn(n):
	return n * n % (pow(10, 9) + 7)
T = int(input())
for i in range(T):
	num = int(input())
	print(sn(num))


MOD = 10 ** 9 + 7
T = int(input())
for _ in range(T):
	n = int(input())
	print(n % MOD * (n % MOD) % MOD)


import sys
import fileinput as fi

def main():
	for line in fi.input():
		if fi.filelineno() > 1:
			n = int(line)
			print(n ** 2 % (10 ** 9 + 7))
main()


mod = 10 ** 9 + 7
t = int(input())
for _ in range(t):
	n = int(input())
	print(n * n % mod)


import sys
T = int(sys.stdin.readline())
for i in range(0, T):
	n = int(sys.stdin.readline())
	print(pow(n, 2, 1000000007))


import fileinput
flag = 0
for line in fileinput.input():
	if flag:
		print(int(line) ** 2 % (10 ** 9 + 7))
	else:
		flag = 1


T = int(input())
while T != 0:
	T -= 1
	x = int(input())
	print(x ** 2 % (10 ** 9 + 7))


t = int(input())
while t > 0:
	t -= 1
	print(int(input()) ** 2 % (10 ** 9 + 7))