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
2015-06-17 11:38:12 Aman Agarwal
nice and easy :)
used modular exponentiation nd precompuattion
2015-06-10 12:57:26 [Mayank Pratap]
@Shubham Jain..... When number of test cases is large like 10000 or several test cases.....then precomputation can help ... :)
2015-06-01 03:51:35 Baymax
use long long int
2015-05-30 14:35:09 harshit sharma
MAGIC... :) TLE in cin cout....accepted with printf scanf :)
2015-05-30 10:05:29 DEEPAK619
My program is giving different answers on DEV C and ideone ....... caused me several wrong answers...... don't know why?????
2015-05-18 07:34:22 Shubham Jain
how i will get to know that a problem requires precomputation ????
2015-04-11 22:05:37 krish
use modulus carefully
and precompute:)
2015-01-05 03:36:44 lovecode
here max value of n is 10^6.........
not more than this........
2015-01-04 17:12:44 Piyush Nirmal
The Pyramid Cluster is unavailable..getting this error after sumitting..what this is all about?? can't i submit a solution??
2014-11-03 07:48:17 Sahil Dua
n can go beyond 1000000 as well. Take care of that. Costed me 3 WA.
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.