import Data.List

main = do
  n <- readLn :: IO Int
  cs <- map read . words <$> getLine :: IO [Int]
  putStrLn $ show (ans n cs)

ans :: Int -> [Int] -> Int
ans n cs = multMod (powMod 2 n) (foldl1 (addMod) (zipWith (multMod) (map (f n) [1..n]) (sort cs)))

f :: Int -> Int -> Int
f 1 a = 1
f n a = multMod (2^(n-2)) (n+2-a)

modulus = 10^9+7

aMod :: Int -> Int 
aMod n = n `mod` modulus

addMod :: Int -> Int -> Int
addMod a b 
    | a + b > modulus = a + b - modulus
    | otherwise = a + b

subMod :: Int -> Int -> Int
subMod a b
    | a - b < 0 = a - b + modulus
    | otherwise = a - b

multMod :: Int -> Int -> Int
multMod a b = (a * b) `mod` modulus

powMod :: Int -> Int -> Int
powMod a b 
    | b == 0 = 1
    | otherwise = f a b
  where
        f x y | even y = f (multMod x x) (y `quot` 2)
              | y == 1 = x
              | otherwise = g (multMod x x) (y `quot` 2) x
        g x y z | even y = g (multMod x x) (y `quot` 2) z
                | y == 1 = multMod x z
                | otherwise = g (multMod x x) (y `quot` 2) (multMod x z)
