local mod = 1000000007
local mfl = math.floor

local function bmul(x, y)
  return (x * y) % mod
end

local function badd(x, y)
  return (x + y) % mod
end

local n = io.read("*n")
local pow2 = {1}
for i = 2, n + 3 do
  pow2[i] = (pow2[i - 1] * 2) % mod
end

local t = {}
for i = 1, n do t[i] = io.read("*n") end
table.sort(t)
local ret = 0
for i = 1, n do
  local c = t[i]
  c = bmul(c, pow2[i])
  -- rem = r
  -- 1*rC0 + 2*rC1 + ... + r*rCr = (r+2) / 2 * 2^r
  local rem = n - i
  local p = i == n and 500000004 or pow2[rem]
  local mul = bmul(rem + 2, p)
  c = bmul(c, mul)
  ret = badd(ret, c)
end
ret = bmul(ret, pow2[n + 1])
print(ret)
