spoj#DALTSUM. Descending Alternating Sums

Descending Alternating Sums

Given an array A of k integers (not necessarily distinct), we define the descending alternating sum of this array, denoted F(A) the following way. First, we sort the array in descending order. Suppose the elements, after sorting, are A1A2 ≥ ... ≥ Ak respectively. Then the descending alternating sum of array A is

F(A) = A1 - A2 + A3 - ... + (-1)k+1 Ak.

For example, if A = [5, -3, 8, 2, 0, -5] then after sorting it in descending order, we find A = [8, 5, 2, 0, -3, -5]. So the descending alternating sum of this array is 8 - 5 + 2 - 0 + (-3) - (-5) = 7. In particular, the descending alternating sum of an empty array is 0.

You are given an array A of n integers where 1 ≤ n ≤ 105 and |Ai| ≤ 1018. You have to print the sum of the descending alternating sums of all subsets of this array A (there are 2n of them) modulo M = 109 + 7. In other words, if the subsets of array A are S1, S2, ..., S2n then you have to print the sum

F(S1) + F(S2) + ... + F(S2n) modulo M = 109 + 7.

Note: we consider some integer modulo a positive integer to be non-negative. In the other words, the output R must satisfy the inequality 0 ≤ R < M.

Input

The first line of the input file contains a single integer n, denoting the size of the array A.

The second line contains n integers A1, A2, ..., An, the elements of the array A.

Output

Print a single integer, the sum of descending alternating sums of all subsets of the array A.

Example

Input:
3
-1 9 3
Output: 36