The chef is trying to solve some series problems, Chef wants your help to code it. Chef has one number N. Help the chef to find N'th number in the series.
0, 1, 5, 14, 30, 55 …..

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, one integer $N$. 

-----Output:-----
For each test case, output as the pattern.

-----Constraints-----
- $1 \leq T \leq 10^4$
- $1 \leq N \leq 10^4$

-----Sample Input:-----
3
1
7
8

-----Sample Output:-----
0
91
140

Source: codechef | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
T = int(input())
for i in range(T):
	n = int(input())
	if n == 1:
		print('0')
	else:
		n = n - 2
		l = (n + 1) * (2 * n + 3) * (n + 2) / 6
		print(int(l))


for _ in range(int(input())):
	k = int(input())
	print(int((k - 1) * k * (2 * k - 1) / 6))


testcases = int(input())
for i in range(testcases):
	n = int(input())
	n -= 1
	sum1 = n * (n + 1) * (2 * n + 1) // 6
	print(sum1)


e = []
for i in range(10001):
	e.append(i * i)
for i in range(1, 10001):
	e[i] += e[i - 1]
for _ in range(int(input())):
	n = int(input())
	print(e[n - 1])


for i in range(int(input())):
	n = int(input())
	if n == 0:
		print(0)
	else:
		n = n - 1
		ans = n * (n + 1) * (2 * n + 1) / 6
		print(int(ans))


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
a = [0] * 10 ** 5
for i in range(len(a)):
	a[i] = a[i - 1] + i * i
for _ in range(int(input())):
	k = int(input())
	print(a[k - 1])


arr = [0] * 10000
for i in range(1, 10000):
	arr[i] = arr[i - 1] + i * i
t = int(input())
for i in range(t):
	n = int(input())
	print(arr[n - 1])


for _ in range(int(input())):
	n = int(input())
	n = n - 1
	su = n * (n + 1) * (2 * n + 1) // 6
	print(su)


size = 10 ** 4 + 1
dp = [0 for x in range(size)]
for i in range(1, size):
	dp[i] = dp[i - 1] + i * i
t = int(input())
for i in range(t):
	num = int(input())
	print(dp[num - 1])


l = []
s = 0
for i in range(10 ** 5):
	s += i ** 2
	l.append(s)
for _ in range(int(input())):
	n = int(input())
	if n <= len(l):
		print(l[n - 1])
	else:
		for i in range(10 ** 4, n + 1):
			s += i ** 2
			l.append(s)
		print(s)


for _ in range(int(input())):
	n = int(input())
	n = n - 1
	s = n * (n + 1) * (2 * n + 1) / 6
	print(int(s))


try:
	for i in range(int(input())):
		n = int(input())
		a = 0
		b = 1
		if n == 1:
			print('0')
		elif n == 2:
			print('1')
		else:
			print((n - 1) * n * (2 * (n - 1) + 1) // 6)
except Exception:
	pass


dp = [0] * 10000
for i in range(1, 10000):
	dp[i] = dp[i - 1] + i * i
for i in range(int(input())):
	n = int(input())
	print(dp[n - 1])


t = int(input())
while t > 0:
	n = int(input())
	nth = n * (n + 1) * (2 * n + 1) // 6 - n * n
	print(nth)
	t -= 1


t = int(input())
for _ in range(t):
	n = int(input())
	n -= 1
	j = n * (n + 1) * (2 * n + 1) / 6
	print(int(j))


for _ in range(int(input())):
	r = int(input())
	r -= 1
	r = r * (r + 1) * (2 * r + 1)
	print(r // 6)


T = int(input())
for t in range(T):
	K = int(input())
	if K == 0:
		print('0')
	else:
		K = K - 1
		output = K * (K + 1) * (2 * K + 1) / 6
		print(int(output))


from sys import *
input = stdin.readline
t = int(input())
for _ in range(t):
	n = int(input())
	print((n - 1) * n * (2 * (n - 1) + 1) // 6)


for _ in range(int(input())):
	n = int(input())
	n = n - 1
	answer = n * (n + 1) * (2 * n + 1) // 6
	print(answer)