Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read

import heapq
mod = 10**9+7
n, *clst = map(int, read().split())
if n == 1:
  print(2*clst[0] % mod)
  quit()
heapq.heapify(clst)
import numpy as np
clst=np.sort(clst)
d=2**(n-2)
start = 2**(n-1)+(n-1)*d
end = 2**(n-1)-1
q=np.arange(start,end,-d)

res=np.sum(clst*q)
print(2**n*res % mod)

Fixed submission:
import sys
read = sys.stdin.buffer.read
mod=10**9+7
n, *clst = 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)

Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read

import heapq
mod = 10**9+7
n, *clst = map(int, read().split())
if n == 1:
  print(2*clst[0] % mod)
  quit()
heapq.heapify(clst)
import numpy as np
clst=np.sort(clst)
q=np.arange(2**(n-1)+(n-1)*2**(n-2),2**(n-1)-1,-2**(n-2))

res=np.sum(clst*q)
print(2**n*res % mod)


Fixed submission:
import sys
read = sys.stdin.buffer.read
mod=10**9+7
n, *clst = 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)

Buggy python submission (verdict: Runtime Error):
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 = map(int, read().split())
if n == 1:
  print(2*clst[0] % mod)
  quit()
heapq.heapify(clst)
import numpy as np
clst=np.array(clst)
q=np.arange(2**(n-1)+(n-1)*2**(n-2),2**(n-1)-1,-2**(n-2))
res=np.sum(clst*q)
print(2**n*res % mod)

Fixed submission:
import sys
read = sys.stdin.buffer.read
mod=10**9+7
n, *clst = 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)

Buggy python submission (verdict: Runtime Error):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
mod = 10**9+7
n, *clst = map(int, read().split())
if n == 1:
  print(2*clst[0] % mod)
  quit()
import numpy as np
clst=np.array(clst)
clst=np.sort(clst)
q=np.arange(2**(n-2)+n*2**(n-2),2**(n-1)-1,-2**(n-2))
 
res = np.sum(clst*q)
print(2**n*res % mod)

Fixed submission:
import sys
read = sys.stdin.buffer.read
mod=10**9+7
n, *clst = 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)

Buggy python submission (verdict: Time Limit Exceeded):
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 = 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)

Fixed submission:
import sys
read = sys.stdin.buffer.read
mod=10**9+7
n, *clst = 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)