# zoj 3903 Ant(推公式，逆元）

2015年10月18日 作者 CrazyKK

Ant

Time Limit: 1 Second      Memory Limit: 32768 KB

There is an ant named Alice. Alice likes going hiking very much. Today, she wants to climb a cuboid. The length of cuboid’s longest edge is n, and the other edges are all positive integers. Alice’s starting point is a vertex of this cuboid, and she wants to arrive at the opposite vertex. The opposite vertex means the vertex which has no common planes or edges with the starting point. Just like the picture below:

Alice is very clever, she always walks on the shortest path. But she can only walk on the surface of the cuboid. Now, Alice only knows the length of cuboid’s longest edge is n, and doesn’t know the length of other edges. Suppose the L is the length of shortest path of a cuboid. Alice wants to compute the sum of L2 for every possible cuboid.

#### Input

The first line of input contains an integer T(T ≤ 100) . is the number of the cases. In the following T lines, there are a positive integer n(1≤n≤1014) in each line. n is the longest edge of the cuboid.

#### Output

For each test case, output the sum of L2 for every possible cuboid in a line. L is the length of shortest path of a cuboid. It may be very large, so you must output the answer modulo 1000000007.

#### Hint

(3,2,1) and (3,1,2) are regrad as the same cuboids.

n2一共有t个。

a*b可以先把所有的a*b加在一起，再化简。

(n*(n-1)/12 )%mod=(12mod-2*n*(n-1))%mod

o(n)都会跪。。

View Code