# after listening explanation
mod = 1000000007
n = gets.to_i
c = gets.split.map(&:to_i)
c.sort!
c.reverse!
list = [0,1].repeated_permutation(n).to_a
list.shift

p list
num = 0
sum = n.times.map{|i|
  num = list.map{|lista| lista[i]==1 ? lista[0..i].inject(:+) : 0}.inject(:+)
  (c[i]*num)%mod
}.inject(:+)
ans = (2**n) % mod
p ans*sum % mod
