MOD = 10**9 + 7



N = int(eval(input()))

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



As = [1]

accA = 1

m = 2

for i in range(1, N):

    A = (accA + m) % MOD

    As.append(A)

    accA = (accA + A) % MOD

    m = m * 2 % MOD



m = 1

for i in reversed(list(range(N))):

    As[i] = As[i] * m % MOD

    m = m * 2 % MOD



Cs.sort(reverse=True)



ans = 0

for C, A in zip(Cs, As):

    ans += C * A % MOD



print((ans * pow(2, N, MOD) % MOD))

MOD = 10**9 + 7



N = int(eval(input()))

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



Cs.sort(reverse=True)



pow2 = pow(2, 2*N-2, MOD)



ans = 0

for i, C in enumerate(Cs, start=1):

    ans += C*(i+1)*pow2

    ans %= MOD



print(ans)

MOD = 10**9 + 7
N = int(eval(input()))
Cs = list(map(int, input().split()))
As = [1]
accA = 1
m = 2
for i in range(1, N):
    A = (accA + m) % MOD
    As.append(A)
    accA = (accA + A) % MOD
    m = m * 2 % MOD
m = 1
for i in reversed(list(range(N))):
    As[i] = As[i] * m % MOD
    m = m * 2 % MOD
Cs.sort(reverse=True)
ans = 0
for C, A in zip(Cs, As):
    ans += C * A % MOD
print((ans * pow(2, N, MOD) % MOD))

MOD = 10**9 + 7
N = int(eval(input()))
Cs = list(map(int, input().split()))
Cs.sort(reverse=True)
pow2 = pow(2, 2 * N - 2, MOD)
ans = 0
for i, C in enumerate(Cs, start=1):
    ans += C * (i + 1) * pow2
    ans %= MOD
print(ans)

-As = [1] -accA = 1 -m = 2 -for i in range(1, N): -    A = (accA + m) % MOD -    As.append(A) -    accA = (accA + A) % MOD -    m = m * 2 % MOD -m = 1 -for i in reversed(list(range(N))): -    As[i] = As[i] * m % MOD -    m = m * 2 % MOD +pow2 = pow(2, 2 * N - 2, MOD) -for C, A in zip(Cs, As): -    ans += C * A % MOD -print((ans * pow(2, N, MOD) % MOD)) +for i, C in enumerate(Cs, start=1): +    ans += C * (i + 1) * pow2 +    ans %= MOD +print(ans)