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-08-02 05:55:54 Sanchit Manchanda
Getting SIGSEGV for this code. Any idea whats wrongs.
<snip>

Last edit: 2022-07-12 22:49:12
2013-07-22 17:43:59 ***
ans for n=1000000?
2013-06-23 18:27:22 shiv prasad chabarval
mod caused 11 WA's... huh AC with a very bad timing 2.02.
2013-05-18 08:51:14 rafiki93
can you please give some big number test cases.have used mod literally everywhere but still getting wrong ans
2013-05-01 16:36:11 yaswanth
very simple!! similar to http://www.spoj.com/problems/SUMPOWK1/
2013-04-30 02:46:40 Arika Saputro
i reduce from 11 branch to 2 branch and the time only reduced by 0.01 =(
2013-04-03 06:31:21 [Lakshman]
finally AC after several TLE,used precomputation to pass the time limit.
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..
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.