TRICOUNT  Counting Triangles
We define the LEVEL of a triangle as in the following illustrative image:
Task: Your task is very easy. All you have to do is to count all triangles in the biggest one (Level N).
Input
The first line of the input contains an integer T (T ≤ 10000)  the number of test cases and T lines follow. Each line contains an integer N (1 ≤ N ≤ 10^{6}) which is the level of the triangle in that test case.
Output
For each test case, you should write a seperate line: the number of triangles in the biggest one (Level N). (All answers will fit within the range of a 64bit integer)
Example
Input:
3
1
2
3
Output:
1
5
13
Source limit is 500 bytes.
hide comments
anshul2222:
20170921 16:48:05
having tle


zaid9910:
20170915 17:30:54
@shauryauppal This formula is not passing all the test cases. 

anshul0311:
20170810 21:26:09
Can anyone help in deriving this formula ? 

jha_gaurav98:
20170727 04:34:49
I haven't even understood how to draw the triangle of level 3 

jha_gaurav98:
20170727 04:32:36
how did you all got the formula?? some derivation or what? 

babur:
20170702 05:41:53
100% maths....good question 

mukesh3g:
20170624 16:26:42
Last edit: 20170624 22:33:15 

love1024:
20170615 11:53:28
Lots of formulas of triangular number to derive. Last edit: 20170615 11:53:44 

rishabhm123:
20170530 00:05:57
All test cases are getting right..


noxiousav:
20170523 14:39:53
Source Code limit not fit for java! 
Added by:  nha.duong 
Date:  20070805 
Time limit:  1s 
Source limit:  500B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 ERL JSRHINO NODEJS OBJC PERL6 SQLITE VB.NET 
Resource:  Trần Huy Hưng 