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.
for _ in range(int(raw_input())):
	n = int(raw_input())
	print n * (n - 1) / 2