mod=10**9+7

n=int(eval(input()))

arr=list(map(int,input().split()))

arr=sorted(arr)

ans=0

for i in range(n):

  ans+=pow(2,2*n-2,mod)*(n-i+1)*arr[i]

  ans%=mod

print((int(ans)))
mod=10**9+7

n=int(eval(input()))

arr=list(map(int,input().split()))

arr=sorted(arr)

ans=0

total=pow(2,2*n-2,mod)

for i in range(n):

  ans+=total*(n-i+1)*arr[i]

  ans%=mod

print((int(ans)))

mod = 10**9 + 7
n = int(eval(input()))
arr = list(map(int, input().split()))
arr = sorted(arr)
ans = 0
for i in range(n):
    ans += pow(2, 2 * n - 2, mod) * (n - i + 1) * arr[i]
    ans %= mod
print((int(ans)))

mod = 10**9 + 7
n = int(eval(input()))
arr = list(map(int, input().split()))
arr = sorted(arr)
ans = 0
total = pow(2, 2 * n - 2, mod)
for i in range(n):
    ans += total * (n - i + 1) * arr[i]
    ans %= mod
print((int(ans)))

+total = pow(2, 2 * n - 2, mod) -    ans += pow(2, 2 * n - 2, mod) * (n - i + 1) * arr[i] +    ans += total * (n - i + 1) * arr[i]