PUCMM210 - A Summatory


f(n) is defined as: f(n) = 13+23+33+...+n3, so it is the sum of the cubes of all natural numbers up to n.

In this problem you are about to compute,

f(1) + f(2) + f(3) + ... + f(n)

Input

The first line is an integer T (1 ≤ T ≤ 100,000), denoting the number of test cases. Then, T test cases follow.

For each test case, there is an integer n (1 ≤ n ≤ 1,000,000) written in one line.

Output

For each test case output the result of the summatory function described above.

Since this number could be very large, output the answer modulo 1,000,000,003.

Example

Input:
3
2
10
3

Output:
10
7942
46

hide comments
Sivaraman Nagarajan: 2013-02-24 05:39:18

I started to hate MOD problems

Sivaraman Nagarajan: 2013-02-24 05:38:46

There is nothing In it. I thought I can learn a technique but brute force works . Saw few algo with just 6 elements . Hw is that possible

Arika Saputro: 2013-02-10 14:58:35

finally got ac.. nice problem :) main problem is in MOD..

Ouditchya Sinha: 2013-01-26 13:30:25

Nice problem, Got AC :)

Last edit: 2013-02-20 10:01:34
saket diwakar: 2013-01-09 10:02:31

finally solved it....:)

god_father: 2012-12-23 19:29:27

too easy move to tutorial..

tarun sharma: 2012-12-02 12:36:46

some more test cases..

chansiddharth: 2012-11-12 07:16:46

Be careful about the MOD !!!!

Francky: 2012-10-01 19:19:54

@beenu : as it tends to be very formulaic, we can't give you such an answer. You should use a brute force in python to find it...

beenu: 2012-10-01 18:53:21

what is the answer for n=1000000 ???


Added by:Olson Ortiz
Date:2012-05-24
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:Used in 2nd dominican ACM-ICPC Warm Up 2012 Competition in PUCMM