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
Shubham Somani:
2012-10-01 12:53:36
use modulus extravagantly ;) |
|
Utkarsh Shahdeo:
2012-09-22 20:54:47
phew...finally AC!! |
|
ANKIT BATHLA:
2012-06-22 03:07:12
very strict time limit i guess. |
|
Robert:
2012-06-19 14:55:35
lol |
|
(Tjandra Satria Gunawan)(曾毅昆):
2012-06-07 14:55:39
after you solved this problem you may try this one:
|
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 |