local mod = 1000000007
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end
local n = io.read("*n")
local t = {}
for i = 1, n do
  t[i] = io.read("*n")
end
table.sort(t)
local mul = {1}
for i = 2, n + 1 do
  mul[i] = bmul(mul[i - 1], 2)
end
local ret = 0
local csum = 0
for i = 1, n do
  local c = t[i]
  ret = badd(ret, bmul(c, mul[n]))
  if 1 < i then
    ret = badd(ret, bmul(csum, mul[n - 1]))
  end
  csum = badd(csum, c)
end
ret = bmul(ret, mul[n + 1])
print(ret)
