Amer cabs has released a scheme through which a user gets a free drive when he shares a reference code with another Amer app user. Given N number of app users, output total number of free drives gained by all of them. Two same users cannot share reference code more than once.  

Input Format 
The first line contains the number of test cases T, T lines follow. 
Each line then contains an integer N, the total number of Amer App Users.

Output Format

Print the number of Free Drives for each test-case in a new line.

Constraints

1 ≤ T ≤ 1000
0 < N < 10^6

SAMPLE INPUT
2
1
2

SAMPLE OUTPUT
0
1

Explanation

Case 1 : Single user shares no reference code, hence 0 free drives. 

Case 2 : There are 2 app users, so reference code is shared once, hence 1 free drive.

Difficulty: UNKNOWN_DIFFICULTY

Solutions:
t = int(eval(input()))
while t > 0:
	n = int(eval(input()))
	print(n*(n-1)//2)
	t -= 1


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


kases = int(eval(input()))
for kase in range(kases):
	free = 0
	N = int(eval(input()))
	for i in range(1,N+1):
	    free = free + (N-i)
	print(free)
	


if __name__=='__main__':
	for i in range(0,int(eval(input()))):
		n = int(eval(input()))
		print(((n*(n-1))//2))
		


test=int(eval(input()))
while(test>0):
	N=int(eval(input()))
	sum=0
	for i in range(1,N):
		sum+=i
	print(sum)
	test-=1


for tc in range(eval(input())):
	n=int(eval(input()))
	print((n*(n-1)//2))