ARG_N= gets.to_i
ARG_C= gets.split.map(&:to_i).sort
MOD = 10**9+7
MAX=ARG_N+1
n = 0
score =0
while n < ARG_N do
  pet = 2**(2*ARG_N-1) % MOD
  score = (score + pet * ARG_C[n] * ( ARG_N - n + 1)/2) % MOD
  n+=1
end
puts score % MOD