Not Very Powerful#12464

Not Very Powerful

2 seconds
256 megabytes
Medium

You are given an array consisting of elements numbered 1,2,...,n; define the value of an array as follows:

v(a) = \sum_{i=1}^{n} (-a_i)^i

The value of an empty array is .

Let be the sum of the values over all subsequences of the array .

Please find ; since the answer can be very large, print it modulo 10^9 + 7.

Input

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

The first line of each test case contains a single integer (1 \le n \le 5 \cdot 10^5) the size of the array.

The second line of each test case contains integers a_i (0 \le a_i \le 10^9) the elements of the array.

It is guaranteed that the sum of over all test cases does not exceed 5 \cdot 10^5.

Output

For each test case, print a single integer — .

Examples

Example 1

Loading
Loading

Note

In the first test case, the subsequences are [],[1],[2],[3],[1,2],[1,3],[2,3],[1,2,3].

v([]) = 0.

v([1]) = (-1)^1 = -1 , v([2]) = (-2)^1 = -2 , v([3]) = (-3)^1 = -3.

v([1,2]) = (-1)^1 + (-2)^2 = -1+4 = 3.

v([1,3]) = (-1)^1 + (-3)^2 = -1+9 = 8.

v([2,3]) = (-2)^1 + (-3)^2 = -2+9 = 7.

v([1,2,3]) = (-1)^1 + (-2)^2 + (-3)^3 = -1 + 4 - 27 = -24.

So f(a) = 0-1-2-3+3+8+7-24 = -12.

mod = .

Scoring

  • Subtask ( points): No additional constraints.