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
2012-04-22 18:43:17 JustDoIt



Last edit: 2012-04-22 18:43:34
2012-04-17 18:18:14 spock
same question as beehive numbers..
2012-04-14 15:33:03 Darky
The same code that works for Pyth3 gives WA for JAVA...maybe because of data types in JAVA?
2012-04-07 21:22:33 Mukul
TLE...:(:(
2012-04-07 08:39:36 abd alkader
hh

Last edit: 2012-04-07 08:39:56
2012-03-25 16:43:53 tantu28
@yahya:ter s another efficient way to do it...very simple...jus tink off..

Last edit: 2012-03-25 16:49:39
2012-02-11 15:26:28 Atanu


Last edit: 2012-02-11 15:26:43
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.