MOD = 1000000007

def power(a, n)
  return 1 if n == 0
  return a if n == 1
  if n % 2 == 0
    p = power(a, n / 2)
    return p * p % MOD
  else
    p = power(a, n - 1)
    return p * a 
  end
end

def main

  n = gets.chomp.to_i
  costs = gets.chomp.split.map(&:to_i)
  costs.sort!.reverse!
   
#コストにかかる係数
  step = power(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
end

main