N = gets.to_i
cs = gets.split.map(&:to_i).sort

i = cs.length - 1
ret = 0
mul = 2**(N-1)
while 0 <= i
  ret += (cs[i] * mul) % (10**9+7)
  mul += 2**(N-2)
  i -= 1
end

ret = ((2**N)*ret) % (10**9+7)

p ret