MOD = 1000000007
n = gets.chomp.to_i
costs = gets.chomp.split.map(&:to_i)
costs.sort!.reverse!

#コストにかかる係数
step = 2 ** (n - 2)
base = step * 2

if n == 1
  coef = [1]
else
  coef = n.times.map {|v| 
    base + step * v
  }
end


ans = 0
n.times do |i|
  ans += costs[i] * coef[i] % MOD
end

ans = ans << n
puts ans % MOD