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
2014-10-12 17:38:35 karan
:D
2014-05-22 18:17:26 Amit Doshi
An easy problem which I managed to screw, owing to blank spaces.
2014-05-14 14:43:24 Francky
Image inserted in description.
2014-05-13 05:00:50 shyam vinay
Note, there's an extra blank line after reading in T value. It costed me 2 WAs.
2014-04-29 08:35:40 SHIVAM DIXIT
http://cf.ltkcdn.net/boardgames/images/std/50408-283x424-Card_pyramid.jpg
try forming a relation between cards at nth level to that of (n-1)th level...
2014-01-23 08:34:57 sarelfeniel
Here is the image from KP on a previous page.

http://cf.ltkcdn.net/boardgames/images/std/50408-283x424-Card_pyramid.jpg


2014-01-14 17:12:17 Ankit Jain
very easy.....:)
2014-01-14 08:27:22 xx_xx
after 2 times get TLE. nice problem.. :)
2013-12-24 11:17:03 Manit Gupta
shortest code ever. ;)

Last edit: 2013-12-24 11:17:15
2013-11-11 18:54:49 Ruchir Sharma
I am not able to see the image.. Where is the image ?
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.