MOD = 1000000007
n = gets.chomp.to_i
costs = gets.chomp.split.map(&:to_i)
costs.sort!.reverse!
coef = []
 
#コストにかかる係数
step = 2 ** (n - 2)
base = step * 2
 
coef[0] = base
if n == 1
  coef = [1]
else
  (n-1).times {|i|
    coef[i+1] = coef[i] + step
  }
end
 
 
ans = 0
n.times do |i|
  ans += costs[i] * coef[i] % MOD
end
 
ans = ans << n
puts ans % MOD