CodeEff/ECCO huggingface dataset:
# Original solution
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
p2 = [1]*N
for i in range(1,N):
  p2[i] = p2[i-1]*2%mod
N,*C = list(map(int, open(0).read().split()))
C.sort()
ans = 0
for i,c in enumerate(C):
  n = N-1-i
  ans += c*(n*p2[n-1]+p2[n])*p2[n+1]*p2[2*i]%mod
print((ans%mod))

# Optimized solution
N,*C = list(map(int, open(0).read().split()))
MOD = 10**9+7
p2 = [1]*(2*N+1)
for i in range(1,2*N+1):
  p2[i] = p2[i-1]*2%MOD
C.sort()
ans = 0
for i,c in enumerate(C):
  n = N-1-i
  ans += c*(n*p2[n-1]+p2[n])*p2[N+i]%MOD
print((ans%MOD))
# Original solution
N=int(eval(input()))
C=list(map(int,input().split()))
C.sort()

mod=10**9+7


ans=0
for i in range(N):
    ans+=C[i]*(N-i+1)
    ans%=mod
    
p=pow(4,N-1,mod)
print(((ans*p)%mod))



# Optimized solution
import sys
input = sys.stdin.readline

def I(): return int(eval(input()))
def MI(): return list(map(int, input().split()))
def LI(): return list(map(int, input().split()))

"""
Sは全部0と仮定して良い，最後に2^N倍
Cはソートしておく，後ろから使う．

iは0indexとする
各C[i]ごとに見るか，そうしたら，それが何番目かによって寄与が決まる
i桁目なので左にi桁あるけど，これは通り数にしか関与しない
右側にN-i-1(=aとする)桁分ある．a桁のうちj桁1があるとして，寄与がj*C[i]

通り数：
右：a個からj個えらぶ=aCj
左：0でも1でも置ける=2^i

変更時のD：j+1

i,jの2つのΣで考えると，j側は結局Σ((j+1) * aCj)
j=0~aでΣ(j+1 * aCj) = (a+2) * pow(2,a-1) = (N-i+2) * pow(2,a-1)

"""

def main():
    mod=10**9+7
    N=I()
    C=LI()
    C.sort()
    ans=0
    
    def calc(ii):
        a = N-ii-1
        if a==0:
            temp_j=1
        else:
            temp_j = (a+2) * pow(2,a-1,mod)
        temp = C[ii]*pow(2,ii,mod)*temp_j
        return temp%mod
    
    for i in range(N):
        ans=(ans+calc(i))%mod
        
    ans=(ans*pow(2,N,mod))%mod
        
    print(ans)

  

main()
# Original solution
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(eval(input()))
def II(): return list(map(int, input().split()))
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return list(map(list, list(zip(*read_all))))

#################

N = I()
C = III()
C.sort()

ans = 0
for i in range(N):
    ans += 4**(N-1)*C[i]*(N-i+1)
    ans %= mod

print(ans)

# Optimized solution
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(eval(input()))
def II(): return list(map(int, input().split()))
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[] for _ in range(num)]
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return list(map(list, list(zip(*read_all))))

#################

N = I()
C = III()
C.sort()

ans = 0
for i in range(N):
    ans += pow(4,N-1,mod)*C[i]*(N-i+1)
    ans %= mod

print(ans)
# Original solution
N = int(eval(input()))
C = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

C.sort()

ret = 0
for i in range(N) :
  rest = N - i - 1
  if rest == 0 :
    ret += C[i] * pow(4, i, mod) * pow(2, N - i, mod) * pow(2, rest, mod) % mod
  else :
    ret += C[i] * pow(4, i, mod) * pow(2, N - i, mod) * (rest + 2) * pow(2, rest - 1, mod) % mod
  ret %= mod

print(ret)

# Optimized solution
N = int(eval(input()))
C = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

C.sort()

ret = 0
P = pow(4, N - 1, mod)
for i in range(N) :
  ret += C[i] * P * (N - i + 1) % mod
  ret %= mod

print(ret)
# Original solution
import itertools

num = int(eval(input()))
l = list(map(int, input().split()))

total = 0
for i in range(1, num+1):
    for diff_num in itertools.combinations(l, i):
        diff_num = sorted(list(diff_num))
        for j in range(len(diff_num)):
            total += diff_num[j] * (len(diff_num) - j)

total *= 2 ** num
ans = total % (10 ** 9 + 7)
print(ans)

# Optimized solution
# coding: utf-8
# Your code here!

num = int(eval(input()))
costs = sorted(list(map(int, input().split())), reverse = True)

total = 0
for i in range(1, num+1):
    total += (i + 1) * costs[i-1]
ans = (total * (4 ** (num - 1))) % (10 ** 9 + 7)
print(ans)
# Original solution
def main():
    n=int(eval(input()))
    a=list(map(int,input().split()))
    mod=10**9+7
    if n==1:
        print((2*a[0]%mod))
        return
    a.sort(key=lambda x:-x)
    mod=10**9+7
    ans=0
    for i in range(n):
        ans=(ans+pow(2,n-2,mod)*a[i]*(i+2))%mod
    ans=ans*pow(2,n,mod)%mod
    print(ans)

main()

# Optimized solution
def main():
    n=int(eval(input()))
    a=list(map(int,input().split()))
    mod=10**9+7
    if n==1:
        print((2*a[0]%mod))
        return
    a.sort(key=lambda x:-x)
    mod=10**9+7
    ans=sum([a[i]*(i+2)%mod for i in range(n)])
    ans=ans*pow(2,n,mod)*pow(2,n-2,mod)%mod
    print(ans)

main()
# Original solution
MOD = 10**9 + 7
n = int(eval(input()))
c = list(map(int, input().split()))
c.sort()

if n > 1:
    ans = 0
    for i in range(n):
        m = (1 << (n - 1)) + (1 << (n - 2)) * (n - 1 - i)
        ans += c[i] * m
        ans %= MOD

    for i in range(n):
        ans *= 2
        ans %= MOD
else:
    ans = c[0] * 2
    ans %= MOD
print(ans)


# Optimized solution
MOD = 10**9 + 7
n = int(eval(input()))
c = list(map(int, input().split()))
c.sort()

if n > 1:
    ans = 0
    x = (1 << (n - 1)) % MOD
    y = (1 << (n - 2)) % MOD
    for i in range(n):
        m = x + (y * (n - 1 - i)) % MOD
        m %= MOD
        ans += c[i] * m
        ans %= MOD

    for i in range(n):
        ans *= 2
        ans %= MOD
else:
    ans = c[0] * 2
    ans %= MOD
print(ans)
# Original solution
from math import factorial
N = int(eval(input()))
C = list(map(int, input().split()))
C.sort()
MOD = 1000000007
ans = 0
if N == 1:
  ans = C[0]*2 % MOD
else:
  for i in range(N):
    for j in range(i,N):
      ans = (ans + 2**(i+N)*(N-j)*C[i]*factorial(N-i-1)//(factorial(N-j-1)*factorial(j-i))) % MOD

print(ans)

# Optimized solution
n = int(eval(input()))
c = list(map(int, input().split()))
c.sort()
MOD = 1000000007
ans = 0
P = pow(4, n-1, MOD)
if n == 1:
  ans = c[0]*2 % MOD
else:
  for i in range(n):
    ans += P*c[i]*(n+1-i)
    ans %= MOD
 
print(ans)
# Original solution
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

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

# Optimized solution
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


n = int(eval(input()))
a = list(map(int, input().split()))
M = 10**9+7

pp = [None]*n
v = 1
for i in range(n):
    pp[i] = v
    v *= 2
    v %= M

a.sort()
a = a[::-1]
ans = 0
ans += a[0]*(pow(2, 0, M))*pow(2, n-1,M)
for i in range(1,n):
    num = a[i]
    ans += num*(pp[i] + i*pp[i-1])*pp[n-i-1]
    ans %= M
ans *= pow(2,n,M)
ans %= M
print(ans)
# Original solution
N=int(eval(input()))
c=sorted([int(i) for i in input().split()])
mod=10**9+7
ans=0
for i in range(N):
    ans+=(c[i]*(((N-i+1)*pow(2,(N-2)%(mod-1),mod))%mod))%mod
    ans%=mod
print(((ans*pow(2,N,mod))%mod))

# Optimized solution
N=int(eval(input()))
c=list(map(int,input().split()))
c.sort()
m=10**9+7
ans=0
for i in range(N):
    ans+=(c[i]*(N-i+1)*pow(2,(N-2)%(m-1),m))%m
print(((ans*pow(2,N,m))%m))
# Original solution
N=int(eval(input()))
c=list(map(int,input().split()))
c.sort()
m=10**9+7
ans=0
for i in range(N):
    ans+=(c[i]*(N-i+1)*pow(2,(N-2)%(m-1),m))%m
print(((ans*pow(2,N,m))%m))

# Optimized solution
N=int(eval(input()));c=sorted(list(map(int,input().split())));m=10**9+7;ans=0
for i in range(N):ans+=c[i]*(N-i+1)*pow(2,2*N-2,m)
print((ans%m))
# Original solution
# 解説放送を見た
# https://youtu.be/9MphwmIsO7Q?t=5738

def main():
    mod = 10 ** 9 + 7

    n = int(eval(input()))
    *c, = list(map(int, input().split()))

    c.sort()

    pw = [1 << j for j in range(n + 1)]

    ret = 0
    for l, x in enumerate(c):
        r = n - 1 - l  # lxr
        ret = (ret + x * pw[l] * (pw[r] + pw[r - 1] * r)) % mod

    ret = ret * pw[n] % mod

    print(ret)


if __name__ == '__main__':
    main()


# Optimized solution
# 解説放送を見た
# https://youtu.be/9MphwmIsO7Q?t=5738

def main():
    mod = 10 ** 9 + 7

    n = int(eval(input()))
    *c, = list(map(int, input().split()))

    c.sort()

    pw = [1]
    t = 1
    for _ in range(n):
        t = t * 2 % mod
        pw.append(t)

    ret = 0
    for l, x in enumerate(c):
        r = n - 1 - l  # lxr
        ret = (ret + x * pw[l] * (pw[r] + pw[r - 1] * r)) % mod

    ret = ret * pw[n] % mod

    print(ret)


if __name__ == '__main__':
    main()
# Original solution

def resolve():
    MOD = 10 ** 9 + 7
    N = int(eval(input()))
    C = sorted(map(int, input().split()))
    P = [1] * (N + 1)
    for i in range(N):
        P[i + 1] *= P[i] * 2
    ans = 0
    for i in range(N):
        # 各ビットの係数: (2^r + 2^r-1 * r) * 2^l
        l, r = i, N - i - 1
        now = P[r]
        if r != 0:
            now += P[r - 1] * r % MOD
        now *= P[l]
        now *= C[i]
        ans += now % MOD
        ans %= MOD
    ans *= P[N]
    print((ans % MOD))


if __name__ == "__main__":
    resolve()

# Optimized solution

def resolve():
    MOD = 10 ** 9 + 7
    N = int(eval(input()))
    C = sorted(map(int, input().split()))
    P = [1] * (N + 1)
    for i in range(N):
        P[i + 1] *= P[i] * 2
        P[i + 1] %= MOD
    ans = 0
    for i in range(N):
        # 各ビットの係数: (2^r + 2^r-1 * r) * 2^l
        l, r = i, N - i - 1
        now = P[r]
        if r != 0:
            now += P[r - 1] * r
        now *= P[l]
        now *= C[i]
        ans += now
        ans %= MOD
    ans *= P[N]
    print((ans % MOD))


if __name__ == "__main__":
    resolve()
# Original solution
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    c = LI()
    c.sort()
    if n == 1:
        print((2*c[0]%mod))
        return
    k = 1<<(n-2)
    f = [k*(i+2)*pow(2,n,mod)%mod for i in range(n)][::-1]
    ans = 0
    for i in range(n):
        ans += c[i]*f[i]
        ans %= mod
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


# Optimized solution
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from itertools import permutations
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    n = I()
    c = LI()
    c.sort()
    if n == 1:
        print((2*c[0]%mod))
        return
    k = pow(2,n-2,mod)
    p = pow(2,n,mod)
    f = [k*(i+2)%mod for i in range(n)][::-1]
    ans = 0
    for i in range(n):
        ans += c[i]*f[i]
        ans %= mod
    print((ans*p%mod))
    return

#Solve
if __name__ == "__main__":
    solve()
# Original solution
def solve():
  ans = 0
  N = int(eval(input()))
  C = list(map(int, input().split()))
  C.sort()
  mod = 10**9+7
  for i in range(N):
    ans += C[i]*(N+1-i)
    ans %= mod
  ans = ans*pow(2,2*N-2,mod)%mod
  return ans
print((solve()))

# Optimized solution
def solve():
  ans = 0
  N = int(eval(input()))
  C = list(map(int, input().split()))
  C.sort()
  mod = 10**9+7
  for i in range(N):
    ans += C[i]*(N+1-i)
  ans = ans*pow(2,2*N-2)%mod
  return ans
print((solve()))
# Original solution
N = int(eval(input()))
c = list(map(int, input().split()))
c.sort(reverse = True)
mod = 10 ** 9 + 7
tmp = 2 ** (N - 1)
d = tmp // 2
ans = 0
for ci in c:
    ans += (ci * tmp) % mod
    ans %= mod
    tmp = (tmp + d) % mod
print(((ans * 2 ** N) % mod))


# Optimized solution
N = int(eval(input()))
c = list(map(int, input().split()))
c.sort(reverse = True)
mod = 10 ** 9 + 7
tmp = (2 ** (N - 1)) % mod
d  = (2 ** (N - 2)) % mod
ans = 0
for ci in c:
    ans += (ci * tmp) % mod
    ans %= mod
    tmp = (tmp + d) % mod
print(((ans * 2 ** N) % mod))
# Original solution
MOD = 10 ** 9 + 7


def modFact(n):
    global MOD
    if n == 1:
        return 1
    else:
        return (n * modFact(n - 1)) % MOD


def prepare(n):
    global MOD
    modFacts = [0] * (n + 1)
    modFacts[0] = 1
    for i in range(n):
        modFacts[i + 1] = (modFacts[i] * (i + 1)) % MOD

    invs = [1] * (n + 1)
    invs[n] = pow(modFacts[n], MOD - 2, MOD)
    for i in range(n, 1, -1):
        invs[i - 1] = (invs[i] * i) % MOD

    return modFacts, invs


N = int(eval(input()))
C = list(map(int, input().split()))
C.sort()
modFacts, invs = prepare(N)

mod2 = [0] * (N + 1)
mod2[0] = 1
x = 1
for i in range(N):
    mod2[i + 1] = x = (x * 2) % MOD

ans = 0
for i, c in enumerate(C):
    c %= MOD
    N_ = N - i - 1
    for j in range(0, N_ + 1):
        ans += mod2[N_] * mod2[i + 1] * mod2[i] * c * (j + 1) * modFacts[N_] * invs[N_ - j] * invs[j]
        ans %= MOD

print(ans)


# Optimized solution
MOD = 10 ** 9 + 7


N = int(eval(input()))
C = list(map(int, input().split()))
C.sort(reverse=True)

mod4 = [0] * (N + 1)
mod4[0] = 1
for i in range(N):
    mod4[i + 1] = (mod4[i] * 4) % MOD

ans = 0
N4 = mod4[N - 1]
for i, c in enumerate(C):
    j = i + 1
    ans += N4 * (j + 1) * c
    ans %= MOD

print(ans)
# Original solution
import heapq

N = int(eval(input()))
C = list(map(int, input().split()))

ans = 0

if N != 1:
    heapq.heapify(C)
    for i in range(N):
        c = heapq.heappop(C)
        ans += c * (N + 1 - i) * (2 ** (N - 2))
        ans %= 10 ** 9 + 7
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= 10 ** 9 + 7

print(ans)

# Optimized solution
N = int(eval(input()))
C = list(map(int, input().split()))

C.sort()

ans = 0

mod = 10 ** 9 + 7

pattern = (2 ** (N - 2)) % mod

if N != 1:
    for i in range(N):
        c = C[i]
        ans += c * (N + 1 - i) * pattern
        ans %= mod
    ans *= 2 ** N
else:
    ans = C[0] * 2

ans %= mod

print(ans)
# Original solution
#E
n=int(eval(input()))
C=sorted(list(map(int,input().split())))
mod=10**9+7
sum=0
for i in range(n):
    l=i #その桁より左側の桁数(関係ないやつ)
    r=n-i #その桁より右側の個数(その桁自身も含む、1の個数を数えるやつ)
    if r==1:
        ans=2**l%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
    else:
        ans=2**(r-1)%mod
        ans=(ans+(2**(r-2)%mod)*(r-1)%mod)%mod
        ans=ans*2**l%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
print((sum*(2**n%mod)%mod))

# Optimized solution
#E
n=int(eval(input()))
C=sorted(list(map(int,input().split())))
mod=10**9+7

pow2=[1]
for i in range(n+5): #2の累乗(mod 10**9+7)のテーブル作成
    pow2.append(pow2[i]*2%mod)

sum=0
for i in range(n):
    l=i #その桁より左側の桁数(関係ないやつ)
    r=n-i #その桁より右側の個数(その桁自身も含む、1の個数を数えるやつ)
    if r==1:
        ans=pow2[l]
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
    else:
        ans=pow2[r-1]
        ans=(ans+pow2[r-2]*(r-1)%mod)%mod
        ans=ans*pow2[l]%mod
        ans=ans*C[i]%mod
        sum=(sum+ans)%mod
print((sum*pow2[n]%mod))
# Original solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import heapq
mod = 10**9+7
n, *clst = list(map(int, read().split()))
if n == 1:
  print((2*clst[0] % mod))
  quit()
heapq.heapify(clst)
res=0
q=2**(n-1)+(n-1)*2**(n-2)
for i in range(n):
  h=heapq.heappop(clst)
  res+=h*q
  q-=2**(n-2)
print((2**n*res % mod))

# Optimized solution
import sys
read = sys.stdin.buffer.read
mod=10**9+7
n, *clst = list(map(int, read().split()))
if n == 1:
  print((clst[0]*2%mod))
  quit()
clst.sort(reverse=True)
res=sum(i*item for i, item in enumerate(clst,2))
print(((4**(n-1)*res)%mod))
# Original solution
n = int(eval(input()))
c = list(map(int,input().split()))
mod = 10**9+7
c.sort()
ans = 0
for i in range(n):
    ans += c[i]*(2+n-1-i)*4**(n-1)
    ans %= mod

ans %= mod
print(ans)

# Optimized solution
n = int(eval(input()))
c = list(map(int,input().split()))
mod = 10**9+7
c.sort()
ans = 0
for i in range(n):
    ans += c[i]*(2+n-1-i)*pow(4,n-1,mod)
    ans %= mod

ans %= mod
print(ans)
# Original solution
n = int(eval(input()))
c = sorted([int(_) for _ in input().split()])
mod = 10**9 + 7
ans = 0
for i in range(n):
    ans += c[i] * 2**(2 * n - 2) * (n - i + 1)
    ans %= mod
print(ans)


# Optimized solution
n = int(eval(input()))
c = sorted([int(_) for _ in input().split()])
mod = 10**9 + 7
ans = 0
for i in range(n):
    ans += c[i] * pow(2, 2 * n - 2, mod) * (n - i + 1)
    ans %= mod
print(ans)
# Original solution
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    mod = 10**9 + 7

    n = int(eval(input()))
    c = list(map(int, input().split()))
    c.sort()
    res = 0
    b = int(pow(2, n, mod))
    for i in range(n):
        l = int(pow(2, i, mod))
        r = int(pow(2, n-i-1, mod) + (n-i-1)*pow(2, n-i-2))
        res += b*c[i]*l*r % mod
    print((res%mod))

if __name__ == '__main__':
    main()

# Optimized solution
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    import math
    #from math import gcd

    #inf = 10**17
    mod = 10**9 + 7

    n = int(eval(input()))
    c = list(map(int, input().split()))
    c.sort()
    res = 0
    b = pow(2, n, mod)
    for i in range(n):
        l = pow(2, i, mod)
        if n-i-2 >= 0:
            r = pow(2, n-i-1, mod) + (n-i-1)*pow(2, n-i-2, mod)
        else:
            r = pow(2, n-i-1, mod)
        res += b*c[i]*l*r % mod
        res %= mod
    print(res)

if __name__ == '__main__':
    main()
# Original solution
MOD=10**9+7
N=int(eval(input()))
C=sorted(map(int,input().split()))
p=pow(4,N-1,MOD)
ans=0

for i in range(N):
    res=p*C[i]*(N-i+1)
    ans=(ans+res)%MOD
print(ans)

# Optimized solution
M=10**9+7
N=int(eval(input()))
print((pow(4,N-1,M)*sum([C*(N-i+1)%M for i,C in enumerate(sorted(map(int,input().split())))])%M))
# Original solution
def slove():
    import sys
    input = sys.stdin.readline
    ls = list("CODEFESTIVAL2016")
    s = str(input().rstrip('\n'))
    cnt = 0
    for i in range(len(s)):
        if ls[i] != s[i]:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    slove()


# Optimized solution
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    cs = "CODEFESTIVAL2016"
    cnt = 0
    for i in range(len(cs)):
        if s[i] != cs[i]:
            cnt += 1
    print(cnt)


if __name__ == '__main__':
    solve()
# Original solution
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

"""
逆再生。長さL以上になるものをくっつけられる。
一度L以上になったらそこだけ見ていけばよい
"""

N,L = list(map(int,input().split()))
A = [int(x) for x in input().split()]

A2 = [x+y for x,y in zip(A,A[1:])]

M = max(A2)
i = A2.index(M)
if M < L:
    answer = ['Impossible']
else:
    answer = ['Possible']
    i += 1 # ここを最後にする
    answer += [str(x) for x in range(1,i)] + [str(x) for x in range(N-1,i,-1)] + [str(i)]

print(('\n'.join(answer)))

# Optimized solution
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import itertools

# 和がL以上の2つをつなぐ
# 和がL以上のものが1つ作れたら、その周辺だけ処理していけばよい

N,L,*A = list(map(int,read().split()))

S = [0] + [x+y for x,y in zip(A,A[1:])]
M = max(S)
i = S.index(M)

if M < L:
    print('Impossible')
    exit()

answer = list(itertools.chain(list(range(i,0,-1)),list(range(i+1,N))))[::-1]
print('Possible')
print(('\n'.join(map(str,answer))))
# Original solution
import heapq
N, K = map(int, input().split())
A = list(map(int, input().split()))

knot = []
for i in range(N - 1):
    heapq.heappush(knot, (-A[i]-A[i+1], i))

ans = []
seen = [False]*N
while knot:
    L, i = heapq.heappop(knot)
    L = -L

    if seen[i]:
        continue
    if L < K:
        break

    seen[i] = True
    ans.append(i + 1)

    if i + 1 < N - 1:
        heapq.heappush(knot, (-L - A[i + 1], i + 1))
    if i - 1 >= 0:
        heapq.heappush(knot, (-L - A[i - 1], i - 1))

if len(ans) != N - 1:
    print("Impossible")
else:
    print("Possible")
    print(*ans[::-1], sep="\n")


# Optimized solution

def know(N, K, A):
    isOK = False
    for i in range(1, N):
        if A[i] + A[i - 1] >= K:
            isOK = True
            first = i

    if not isOK:
        return ["Impossible"]

    ans = [first]
    for i in range(first + 1, N):
        ans.append(i)
    for i in range(first - 1, 0, -1):
        ans.append(i)
    return ["Possible"] + ans[::-1]


if __name__ == "__main__":
    N, K = map(int, input().split())
    A = list(map(int, input().split()))
    ans = know(N, K, A)
    print(*ans, sep="\n")
# Original solution
dp=[[1<<30 for _ in range(1001)] for _ in range(1001)]
dp[0][0]=0
n,m=list(map(int,input().split()))
d=[int(eval(input())) for _ in range(n)]+[0]
c=[int(eval(input())) for _ in range(m)]+[0]
for i in range(m):
    for j in range(n+1):
        if dp[i][j]< dp[i+1][j]:dp[i+1][j]=dp[i][j]
        e=d[j]*c[i]
        if dp[i][j]+e<dp[i+1][j+1]:dp[i+1][j+1]=dp[i][j]+e;
dp=list(zip(*dp[::-1]))
print((min(dp[n])))

# Optimized solution
dp=[[1<<30 for _ in range(1001)] for _ in range(1001)]
dp[0][0]=0
n,m=list(map(int,input().split()))
d=[int(eval(input())) for _ in range(n)]+[0]
c=[int(eval(input())) for _ in range(m)]+[0]
for i in range(m):
    for j in range(n+1):
        if dp[i][j]< dp[i+1][j]:dp[i+1][j]=dp[i][j]
        e=d[j]*c[i]
        if dp[i][j]+e<dp[i+1][j+1]:dp[i+1][j+1]=dp[i][j]+e;
print((dp[m][n]))
# Original solution
INF = 10 ** 20

n, m = list(map(int, input().split()))
dist = []
weth = []
for _ in range(n):
  dist.append(int(eval(input())))
for _ in range(m):
  weth.append(int(eval(input())))

dp = [INF] * (n + 1)
dp[0] = 0
for i in range(m):
  for j in range(n, 0, -1):
    dp[j] = min(dp[j], dp[j - 1] + dist[j - 1] * weth[i])
print((dp[n]))


# Optimized solution
INF = 10 ** 20
n, m = list(map(int, input().split()))
dist = [int(eval(input())) for _ in range(n)]
weth = [int(eval(input())) for _ in range(m)]
dp = [INF] * (n + 1)
dp[0] = 0
for i in range(m):
  for j in range(n, 0, -1):
    dp[j] = min(dp[j], dp[j - 1] + dist[j - 1] * weth[i])
print((dp[n]))