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
Aman Agarwal: 2015-06-17 11:38:12

nice and easy :)
used modular exponentiation nd precompuattion

[Mayank Pratap]: 2015-06-10 12:57:26

@Shubham Jain..... When number of test cases is large like 10000 or several test cases.....then precomputation can help ... :)

Baymax: 2015-06-01 03:51:35

use long long int

harshit sharma: 2015-05-30 14:35:09

MAGIC... :) TLE in cin cout....accepted with printf scanf :)

DEEPAK619: 2015-05-30 10:05:29

My program is giving different answers on DEV C and ideone ....... caused me several wrong answers...... don't know why?????

Shubham Jain: 2015-05-18 07:34:22

how i will get to know that a problem requires precomputation ????

krish: 2015-04-11 22:05:37

use modulus carefully
and precompute:)

lovecode: 2015-01-05 03:36:44

here max value of n is 10^6.........
not more than this........

Piyush Nirmal: 2015-01-04 17:12:44

The Pyramid Cluster is unavailable..getting this error after sumitting..what this is all about?? can't i submit a solution??

Sahil Dua: 2014-11-03 07:48:17

n can go beyond 1000000 as well. Take care of that. Costed me 3 WA.


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