DIG  DIAGONAL
You are a given a n sided convex polygon. Find total number of intersections of all diagonals.
Assume that all the intersection points are different.
If in case answer exceeds 10^9 + 7 , take modulo 10^9 + 7
1<=n<=10^8
Input
First Line : T (no of test cases)
Next T line will contain N no of vertices
Output
No of intersections of diagonals as specified.
Example
Input:
2
4
5
Output:
1
5
hide comments
aaditya111:
20170719 14:05:03
Use 24*10000000007L for taking modulo in c ,lest u will get stroked! 

vineetpratik:
20160706 14:02:05
derive formula and then modular division/multiplication AC 

mkfeuhrer:
20160705 15:23:08
easy if u knw the formula!! formula derivation requires some work!! i did dat while my jee prep.(chp = P& C) :P


kanishtalwar:
20151027 19:24:04
Last edit: 20151027 19:26:03 

Francky:
20140529 22:50:01
@candide : Suppose for a while «diagonal means unbounded», what would be the interest to specify "convex" ? ans=NULL. Now suppose the opposite, "convex" makes sens in the problem statement. In this condition, we can honestly assert «here, diagonal means bounded».


candide:
20140529 22:12:51
@flago


Flago:
20140528 15:35:05
@candide : given a *convex* polygon, so it is specified. 

candide:
20140426 08:42:47
Interesting question, not tutorial at all. But problem statement is ambiguous : the fact that diagonal intersections to be INSIDE the polygon is not specified. There is a similar formula for the case where you don't care about the position of the intersection. Moreover, examples are poorly chosen for not allowing to discriminate the two cases. Another remark : cases n=1 and n=2 are meaningless. Last edit: 20140426 08:44:21 

Francky:
20120809 17:35:41
Arghh, convex is very important, I first solved for diagonal lines of any polygon. 

:D:
20120808 13:56:53
I didn't find it trivial just easy. Is it easy because there's a know formula for it or is it really so basic to construct the formula on your own? 
Added by:  praveen123 
Date:  20120801 
Time limit:  0.171s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 
Resource:  general problem 