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 = (2 * (sum (map (amari) (zipWith (*) (map (f n) [1..n]) (sort cs))))) `mod` (10^9+7)

f :: Int -> Int -> Int
f 1 a = 1
f n a = ((2^(n-2)) * (n+2-a)) `mod` (10^9+7)

amari :: Int -> Int
amari a = a `mod` (10^9+7)
