Palindrome Subsequence Sum#12335

Palindrome Subsequence Sum

1 second
256 megabytes
Medium

Define to be the length of the shortest subsequence of array (with length greater than ) which is a palindrome.

If there is no palindrome subsequence of length , then f(a) = 0.

Calculate \sum f(a) over all arrays of length with integers from to . Output the answer modulo 10^9 + 7

Formally , Compute

\displaystyle \left( \underset{\underset{\displaystyle |a|=n}{1 \le a_1,a_2,..,a_n \le n}}{\sum f(a)} \ \ \ \bmod 10^9+7 \right )

You are given test cases. Please answer all of them.

Note:

A subsequence is a sequence that can be derived from the given sequence by deleting zero or more elements without changing the order of the remaining elements.

A palindrome is a sequence that reads the same forwards and backwards.

Input

The first line contains single integer (1 \le t \le 10^4) — the number of test cases.

The only line of each test case contains a single integer (1 \le n \le 10^6) — the length of desired arrays.

There are no constraints on the sum of

Output

For each test case , Output the answer modulus 10^9+7.

Examples

Example 1

Loading
Loading

Note

With n = 2, there are possible arrays:

[1, 1], [1, 2], [2, 1], [2, 2]

Calculating for each:

  • f([1, 1]) = 2

  • f([1, 2]) = 0

  • f([2, 1]) = 0

  • f([2, 2]) = 2

So the total sum is 2 + 0 + 0 + 2 = 4.

Scoring

  1. Subtask ( points): (1\le n \le 6)

  2. Subtask ( points): (1\le n \le 9)

  3. Subtask ( points): No additional constraints