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
sachin kumar vashsistha: 2012-06-15 02:02:42

getting TLE pl. help

cool_frog: 2012-06-12 05:56:39

@sunny....same here !

Last edit: 2012-06-12 07:15:18
sunny shetty: 2012-06-07 09:57:49

getting wrong answer even after satisfying all cases

B.R.ARVIND: 2012-06-05 13:34:26

wher is d image in this?

Aman Kasliwal: 2012-05-12 19:12:30

AC :)
Thanks a lot Aditya !


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