CRDS - Cards

no tags 

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

hide comments
gourav: 2013-01-01 08:43:01

century with this question :-)

dashingvimeet: 2012-11-02 15:34:15

nice problem..

K.P.: 2012-09-25 01:24:40

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

Deepanshu Mehta: 2012-08-14 18:10:49

wat image ?

vipul sharma: 2012-08-05 14:17:16

Last edit: 2012-08-09 11:20:59

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