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

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

hide comments
2013-02-24 05:39:18 Sivaraman Nagarajan
I started to hate MOD problems
2013-02-24 05:38:46 Sivaraman Nagarajan
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
2013-02-10 14:58:35 Arika Saputro
finally got ac.. nice problem :) main problem is in MOD..
2013-01-26 13:30:25 Ouditchya Sinha
Nice problem, Got AC :)

Last edit: 2013-02-20 10:01:34
2013-01-09 10:02:31 saket diwakar
finally solved it....:)
2012-12-23 19:29:27 god_father
too easy move to tutorial..
2012-12-02 12:36:46 tarun sharma
some more test cases..
2012-11-12 07:16:46 chansiddharth
Be careful about the MOD !!!!
2012-10-01 19:19:54 Francky
@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...
2012-10-01 18:53:21 beenu
what is the answer for n=1000000 ???
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.