import sys

import itertools

# import numpy as np

import time

import math

import heapq

from collections import defaultdict

from collections import Counter

sys.setrecursionlimit(10 ** 7)

 

INF = 10 ** 18

MOD = 10 ** 9 + 7

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



# map(int, input().split())



import sys

import itertools

# import numpy as np

import time

import math

from heapq import heappop, heappush

from collections import defaultdict

from collections import Counter

from collections import deque

sys.setrecursionlimit(10 ** 7)

 

INF = 10 ** 18

MOD = 10 ** 9 + 7

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



# map(int, input().split())

N = int(eval(input()))

C = list(sorted(map(int, input().split()), reverse=True))



MAX = 2 * 10 ** 5 + 5

MOD = 10 ** 9 + 7



fac = [0 for i in range(MAX)]

finv = [0 for i in range(MAX)]

inv = [0 for i in range(MAX)]



def comInit(mod):

    fac[0], fac[1] = 1, 1

    finv[0], finv[1] = 1, 1

    inv[1] = 1

    for i in range(2, MAX):

        fac[i] = fac[i - 1] * i % mod

        inv[i] = mod - inv[mod % i] * (mod // i) % mod

        finv[i] = finv[i - 1] * inv[i] % mod





def com(n, r, mod):

    if n < r:

        return 0

    if n < 0 or r < 0:

        return 0

    return fac[n] * (finv[r] * finv[n - r] % mod) % mod



def p(n, r, mod):

    return fac[n] * finv[n - r] % mod

    

comInit(MOD)



ans = 0

pow_list = [1] * (N + 1)

for i in range(1, N + 1):

    pow_list[i] = (2 * pow_list[i - 1]) % MOD

base = pow_list[N]

for i, c in enumerate(C):

    now = pow_list[N - i - 1]

    tot = 0

    if i >= 1:

        tot = pow_list[i] + i * pow_list[i - 1]

    else:

        tot = pow_list[i]

    ans += (tot * now * c) % MOD

    ans %= MOD

print((ans * base % MOD))







MOD = 10 ** 9 + 7

N = int(eval(input()))

C = list(sorted(map(int, input().split()), reverse=True))



ans = 0

pow_list = [1] * (N + 1)

for i in range(1, N + 1):

    pow_list[i] = (2 * pow_list[i - 1]) % MOD

base = pow_list[N]



# 基本戦略:コストが一番高いものを一番最後に変更する

for i, c in enumerate(C):

    now = pow_list[N - i - 1]

    tot = 0

    # コストがi番目に大きい値は、最後からi番目に変更を行うので

    # 左からi-bitまでに何個1が立ったかで加算回数が決まる

    if i >= 1:

        tot = pow_list[i] + i * pow_list[i - 1]

    else:

        tot = pow_list[i]

    ans += (tot * now * c) % MOD

    ans %= MOD

print((ans * base % MOD))
import sys
import itertools

# import numpy as np
import time
import math
import heapq
from collections import defaultdict
from collections import Counter

sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
import sys
import itertools

# import numpy as np
import time
import math
from heapq import heappop, heappush
from collections import defaultdict
from collections import Counter
from collections import deque

sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
N = int(eval(input()))
C = list(sorted(map(int, input().split()), reverse=True))
MAX = 2 * 10**5 + 5
MOD = 10**9 + 7
fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]


def comInit(mod):
    fac[0], fac[1] = 1, 1
    finv[0], finv[1] = 1, 1
    inv[1] = 1
    for i in range(2, MAX):
        fac[i] = fac[i - 1] * i % mod
        inv[i] = mod - inv[mod % i] * (mod // i) % mod
        finv[i] = finv[i - 1] * inv[i] % mod


def com(n, r, mod):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n - r] % mod) % mod


def p(n, r, mod):
    return fac[n] * finv[n - r] % mod


comInit(MOD)
ans = 0
pow_list = [1] * (N + 1)
for i in range(1, N + 1):
    pow_list[i] = (2 * pow_list[i - 1]) % MOD
base = pow_list[N]
for i, c in enumerate(C):
    now = pow_list[N - i - 1]
    tot = 0
    if i >= 1:
        tot = pow_list[i] + i * pow_list[i - 1]
    else:
        tot = pow_list[i]
    ans += (tot * now * c) % MOD
    ans %= MOD
print((ans * base % MOD))

MOD = 10**9 + 7
N = int(eval(input()))
C = list(sorted(map(int, input().split()), reverse=True))
ans = 0
pow_list = [1] * (N + 1)
for i in range(1, N + 1):
    pow_list[i] = (2 * pow_list[i - 1]) % MOD
base = pow_list[N]
# 基本戦略:コストが一番高いものを一番最後に変更する
for i, c in enumerate(C):
    now = pow_list[N - i - 1]
    tot = 0
    # コストがi番目に大きい値は、最後からi番目に変更を行うので
    # 左からi-bitまでに何個1が立ったかで加算回数が決まる
    if i >= 1:
        tot = pow_list[i] + i * pow_list[i - 1]
    else:
        tot = pow_list[i]
    ans += (tot * now * c) % MOD
    ans %= MOD
print((ans * base % MOD))

-import sys -import itertools - -# import numpy as np -import time -import math -import heapq -from collections import defaultdict -from collections import Counter - -sys.setrecursionlimit(10**7) -INF = 10**18 -read = sys.stdin.buffer.read -readline = sys.stdin.buffer.readline -readlines = sys.stdin.buffer.readlines -# map(int, input().split()) -import sys -import itertools - -# import numpy as np -import time -import math -from heapq import heappop, heappush -from collections import defaultdict -from collections import Counter -from collections import deque - -sys.setrecursionlimit(10**7) -INF = 10**18 -MOD = 10**9 + 7 -read = sys.stdin.buffer.read -readline = sys.stdin.buffer.readline -readlines = sys.stdin.buffer.readlines -# map(int, input().split()) -MAX = 2 * 10**5 + 5 -MOD = 10**9 + 7 -fac = [0 for i in range(MAX)] -finv = [0 for i in range(MAX)] -inv = [0 for i in range(MAX)] - - -def comInit(mod): -    fac[0], fac[1] = 1, 1 -    finv[0], finv[1] = 1, 1 -    inv[1] = 1 -    for i in range(2, MAX): -        fac[i] = fac[i - 1] * i % mod -        inv[i] = mod - inv[mod % i] * (mod // i) % mod -        finv[i] = finv[i - 1] * inv[i] % mod - - -def com(n, r, mod): -    if n < r: -        return 0 -    if n < 0 or r < 0: -        return 0 -    return fac[n] * (finv[r] * finv[n - r] % mod) % mod - - -def p(n, r, mod): -    return fac[n] * finv[n - r] % mod - - -comInit(MOD) +# 基本戦略:コストが一番高いものを一番最後に変更する +    # コストがi番目に大きい値は、最後からi番目に変更を行うので +    # 左からi-bitまでに何個1が立ったかで加算回数が決まる