n = gets.to_i
c = gets.split.map(&:to_i)
c.sort!
c.reverse!
list = [0,1].repeated_permutation(n).to_a
list.shift
sum = list.map{|arr|
  point = 0
  counter = 1
  n.times{|i|
    if arr[i]==1
      point += (c[i]*counter)
      counter += 1
    end
  }
  point
}.inject(:+)
ans = (2**n) % 1000000007
p ans*sum % 1000000007
