N = gets.to_i
C = gets.chomp.split(" ").map(&:to_i)
MOD = 10 ** 9 + 7

C.sort!
wk = pow(2, N - 1, MOD)
ans = 0
C.each_with_index{|c, idx|
  wk = (2 * wk) % MOD
  d = N - idx
  tmp = 0
  1.upto(d){|e| tmp = (tmp + e * choose(d - 1, e - 1, MOD) % MOD)}
  ans = (ans + (c * tmp * wk)) % MOD
}

puts ans
