#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template < unsigned MOD >
class Modint
{
    public:
        using uint = unsigned;
        using u64 = uint64_t;
        using i64 = int64_t;

        Modint (const i64 dat = 0) : dat(dat >= 0 ? dat % MOD : (MOD - (-dat) % MOD) % MOD) {}

        constexpr Modint operator + (const Modint &v) const { return ( Modint(dat + v.dat) ); }
        constexpr Modint operator - () const { return ( Modint(-((i64)dat)) ); }
        constexpr Modint operator - (const Modint &v) const { return ( (*this) + -v ); }
        constexpr Modint operator * (const Modint &v) const { return ( Modint((u64)dat * v.dat) ); }

        constexpr Modint operator ~ () const {
            i64 a = dat, b = MOD, x1 = 1, x2 = 0, t;

            while ( b > 0 ) {
                t = a / b;
                swap(a -= t * b, b);
                swap(x1 -= t * x2, x2);
            }

            return ( Modint(x1) );
        }

        constexpr Modint operator / (const Modint &v) const { return ( (*this) * ~v ); }

        Modint &operator = (const i64 &v) { return ( (*this) = Modint < MOD > (v) ); }
        Modint &operator += (const Modint &v) { return ( (*this) = (*this) + v ); }
        Modint &operator -= (const Modint &v) { return ( (*this) = (*this) - v ); }
        Modint &operator *= (const Modint &v) { return ( (*this) = (*this) * v ); }
        Modint &operator /= (const Modint &v) { return ( (*this) = (*this) / v ); }

        constexpr Modint operator ^ (u64 n) const {
            Modint < MOD > ret(1), mul(dat);
            while ( n > 0 ) {
                if ( n & 1 ) ret *= mul;
                mul *= mul;
                n >>= 1;
            }
            return ( ret );
        }

        bool operator == (const Modint &v) { return ( dat == v.dat ); }
        bool operator != (const Modint &v) { return ( dat != v.dat ); }

        friend ostream& operator << (ostream &os, const Modint &p ) {
            return ( os << p.dat );
        }

        friend istream& operator >> (istream &is, Modint &p ) {
            i64 data;
            is >> data;
            p = Modint < MOD >(data);
            return ( is );
        }

    private:
        uint dat;
};

int main() {
    int N;
    int tmp[200005];
    Modint<mod> C[200005];
    Modint<mod> num[200005]; 

    cin >> N;
    for (int i = 0; i < N; i++) cin >> tmp[i];
    sort(tmp, tmp + N);
    for (int i = 0; i < N; i++) C[i] = tmp[i];
   
    num[N - 1] = 1;
    for (int i = N - 2; i >= 0; i--) {
        num[i] = (num[i + 1] * Modint<mod>(2));
        num[i] += Modint<mod>(2)^(N - i - 2);
    }

    Modint<mod> sum = 0;
    for (int i = 0; i < N; i++) {
        sum += C[i] * num[i] * (Modint<mod>(2) ^ i);
    }
    cout << sum * (Modint<mod>(2) ^ N) << endl;

    return (0);
}

Measured memory_bytes: 2560