using System;
using System.Collections.Generic;
using static Assistant.Input;
using System.Linq;
using Assistant;

namespace ABC150E
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadInt;
            var C = ReadInts;
            C = C.OrderBy(x => -x).ToArray();
            int mod = 1000000007;

            long ans = 0;
            dp = new long[N + 1].Select(x => -1L).ToArray();
            //高速
            for (int i = 0; i < N; i++)
            {
                long cand = C[i] * ModPow(2, N - i - 1, mod) % mod;
                cand *= (ModPow(2, i, mod) + i * ModPow(2, i - 1, mod) % mod) % mod;
                cand %= mod;
                ans = (ans + cand) % mod;
            }
            ans = (ans * ModPow(2, N, mod)) % mod;

            //O(n^2)で確認
            //long anstest = 0;
            //for (int i = 0; i < N; i++)
            //{
            //    for (int k = 0; k <= i; k++)
            //    {
            //        long cand = (C[i] * ModPow(2, N - i - 1, mod)) % mod;
            //        cand = (cand * (k + 1) % mod) * nCk(i, k, mod) % mod;
            //        anstest = (anstest + cand) % mod;
            //    }
            //}
            //anstest = (anstest * ModPow(2, N, mod)) % mod;

            Console.WriteLine(ans);
            //Console.WriteLine(anstest);
        }

        static long[] dp;
        /// <summary>
        /// a^n (mod p)
        /// nが非常に大きい時に有効
        /// </summary>
        /// <param name="a"></param>
        /// <param name="n"></param>
        /// <param name="mod"></param>
        /// <returns></returns>
        public static long ModPow(long a, long n, long p)
        {
            if (n < 0) return 0;
            if (dp[n] != -1) return dp[n];
            if (n == 0) return 1;
            if (n == 1) return a % p;
            if (n % 2 == 1) return (a * ModPow(a, n - 1, p)) % p;

            long t = ModPow(a, n / 2, p);
            return dp[n] = (t * t) % p;
        }

        /// <summary>
        /// 組み合わせ個数
        /// </summary>
        /// <param name="n"></param>
        /// <param name="k"></param>
        /// <param name="p"></param>
        /// <returns></returns>
        public static long nCk(long n, long k, long p)
        {
            long ans = 1;
            k = Math.Min(k, n - k);
            for (long i = n; i > n - k; i--)
            {
                ans = (ans * i) % p;
            }

            for (long i = 1; i <= k; i++)
            {
                ans = (ans * ModPow(i, p - 2, p)) % p;
            }

            return ans;
        }
    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String ReadNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int ReadInt => int.Parse(ReadNext());
        public static long ReadLong => long.Parse(ReadNext());
        public static int[] ReadInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] NextLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
    }

    static class Debug
    {
        //drawmap
        //drawarray
    }
}


Measured memory_bytes: 39120