CRDS - Cards

Maricruz have a lot of cards, she always uses her cards to build pyramids as shown in the following image:

Cards

A pyramid card of 3 levels. She always wonder how many cards does she need to make a pyramid card of N levels. Your task is to answer that question.

Input

The first line of the input contains an integer 1 <= T <= 1,000. Each of the following T lines will have an integer 1 <= N <= 1,000,000.

Output

For each case, output a single line consisting of the number of cards needed to build a pyramid card of level N modulo 1,000,007.

Example

Input Example
2
3
7

Output Example
15
77

Added by:Paulo Costa
Date:2012-01-30
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64
Resource:UGTO

hide comments
2015-05-14 19:43:43 Arpan Mukherjee
2 WA -_- 1 for not taking modulo and another for taking modulo as 10^9+7 -_- here modulo isn't 10^9+7,cost me a WA :'(
2015-04-24 18:27:54 NIKHIL KUMAR SINGH
Easy Peasy ... 1 WA due to not taking the modulo
2015-04-23 05:38:27 Chisty
Do take modulo at last. this costed me 1 wa's. Thanks to @Nnavneetsinha
2015-04-18 05:32:41 Tony T.
instructions for the output could really be clearer, taught me that we should all remember to explain ourselves better ;-)

for the benefit for the people doing this question, the output requests for (number of cards needed to make n levels) mod 1000007, not number of cards needed to make (n mod 1000007) levels.
2015-03-08 21:30:22 Vaporeon
AC in first try! 0.00 sec.. do the maths.. ;)
2015-03-04 17:06:33 Dushyant Singh
@K Bala Vignesh - Wait! :-D
2015-03-03 16:36:41 Bala Vignesh [Inactive]
why such an easy one for 0.02 points?

Last edit: 2015-03-03 17:45:40
2015-02-19 18:29:31 Additya
50th <3
2015-01-28 15:00:20 Dushyant Singh
Take long long int in place of int. I got one WA because of that. Easy problem. Try this after solving above problem: http://www.spoj.com/problems/TRICOUNT/
2015-01-27 10:40:18 scyther
do remember to mod!!
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.