Darshak (Dark) completed with his studies and became a engineer, now to earn his bread he decided to start  a company, being a son of rich men he need not to think about investors. 

He came up with a idea  of bringing up a company so as to start with his first investment was to put up computers in his entire building so being a good at networking he used his skills to get the optimum linking between devices(computers) he planned out about the linking, costing etc.Thus, he finished up deciding the costs.

Now it was the time to connect them, thus he connected every device a dedicated point-to-point link to every other device...
which means the link carries the traffic only between two devices it connects.

Thus the fully connected mesh network has "X" physical channels to link 'n' devices and to accommodate that many links every device on the network must have 'n-1'  I/O ports.

The only advantage of putting up such a network was robustness as on failure of any computer it does not bring down the entire network which can also be diagnose easily.

Input:

First line contains 't' number of test cases. Each next 't' lines consists of single number that is the number of devices 'n', Dark wants to connect in his building to develop a network.

Output:

Print the 'X' number of physical channels needed to develop a network.

Constraints:

1 ≤ t ≤ 10^4
1 ≤ n ≤ 10<^7

Author : Darshak Mehta

SAMPLE INPUT
1
3

SAMPLE OUTPUT
3
'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'

n=int(raw_input())

for i in range(n):
	a=int(raw_input())
	print (a*(a-1))/2