2304Get Ai

2304   Get Ai

题目描述

Rcently, Xiaoxi notice a interesting sequence of number, which can be construct in a function below:

int a[MAXN];
void build() {
   int cnt = 0;
   for (int i = 0; i <= n; i++) {
      a[i] = 2 * (cnt + 1);
      int u = cnt;
      for (int k = 1; k <= a[i]; k++) ++cnt;
      for (int h = 1; h <= u; h++) ++cnt;
   }
}



Of course, some unavoidable arithmetic overflow will occur in the above construction function (that is, beyond the int range). Xiaoxi hopes you can improve the above procedure to avoid any possible arithmetic overflow.

After improvement, Xiao Xi wants to know the results after module 1000000007 (1e9 + 7) with the values of some items in the sequence (a[i]) .

输入格式:

The first line of data is the number of cases T.(T<=50000).

Then T lines, each line contains a number n which means the nth number in above sequence a[] Xiaoxi want to know .

0 <= n <= 1e9

输出格式:

For each query, print an integer respecting your answer in one line.

输入样例 复制
6
3
4
5
100
100000
1000000000
输出样例 复制
28
82
244
886041712
916902200
235939646

说明

3
13
通过提交
时空限制1000ms/128mb
题目来源
评测方式在线评测
题目类型
难        度