#include <bits/stdc++.h>
#define isz(x) (int)(x).size()
template<typename T, typename N> 
T pow(T a, N n) {
    T r(1);
    while (n > 0) {
        if (n & 1) { r *= a; }
        a *= a;
        n >>= 1;
    }
    return r;
}
template<int mod>
struct IntMod {
    int value;
    IntMod(int value_ = 0) : value(value_) { }
    IntMod& operator+=(IntMod num) {
        value += num.value;
        if (value >= mod) value -= mod;
        return *this;
    }
    IntMod& operator-=(IntMod num) {
        value -= num.value;
        if (value < 0) value += mod;
        return *this;
    }
    IntMod operator+(IntMod num) const { return IntMod(*this) += num; }
    IntMod operator-(IntMod num) const { return IntMod(*this) -= num; }
    IntMod operator*(IntMod num) const { return IntMod(int(value * 1LL * num.value % mod)); }
    IntMod& operator*=(IntMod num) { return *this = *this * num; }
    IntMod operator/(IntMod num) const { return *this * pow(num, mod-2); }
    IntMod& operator/=(IntMod num) { return *this = *this / num; }
};
template<int mod> bool operator<(IntMod<mod> a,IntMod<mod> b) { return a.value < b.value; }
template<typename T> bool operator>(T a, T b) { return b < a; }
template<typename T> bool operator>=(T a, T b) { return !(a < b); }
template<typename T> bool operator<=(T a, T b) { return !(a > b); }
template<typename T> bool operator!=(T a, T b) { return a < b || b < a; }
template<typename T> bool operator==(T a, T b) { return !(a != b); }

template<int mod>
std::ostream& operator<<(std::ostream& os, const IntMod<mod>& num) {
    return os << num.value;
}
const int mod = (int)1e9+7, NMAX = 256 * 1024;
using Int = IntMod<mod>;
#define watch(x) std::cerr << #x << " = " << x
#define watchln(x) watch(x) << std::endl
#define watchsp(x) watch(x) << " "
#define cerr cerr && debug && std::cerr
#define all(x) (x).begin(),(x).end()
Int fact[NMAX], ifact[NMAX];
void precalc() {
    fact[0] = 1;
    for (int i = 1; i < NMAX; i++) fact[i] = fact[i-1] * i;
    ifact[NMAX-1] = Int(1) / fact[NMAX-1];
    for (int i = NMAX-2; i >= 0; i--) ifact[i] = ifact[i+1] * (i+1);
}
Int C(int n, int k) { return fact[n] * ifact[k] * ifact[n-k]; }
const int debug = 0;
int main() {
    precalc();
    // Input:
    int n;
    while(std::cin >> n) {
        std::vector<int> c(n); 
        for (auto &it : c) std::cin >> it;
        std::sort(all(c));
        Int answ(0), sum(0);
        for (int i = n-1, suff = 0, pref = n-1; i >= 0; i--,suff++,pref--) {
            Int curr = 0;
            if (suff % 2 == 1) {
                
                curr = pow(Int(2),suff-1)*(suff+2); 
            } else {
                // 2 * left + C(suff, suff/2) == 2^suff
                // answer is: left * (suff + 2) + C(suff,suff/2)*suff
                auto half = suff / 2;
                curr += C(suff, half) * (half+1);
                curr += (pow(Int(2), suff) - C(suff, half)) / 2 * (suff + 2);
            }
            /*
            Int tmp(0);
            for (int k = 1; k <= suff+1; k++) {
                tmp += C(suff, k-1) * k;
            }
            if (tmp != curr) {
                watchln(suff);
                watchln(curr);
                watchln(tmp);
            }
            assert(tmp == curr);
            */
            answ += pow(Int(2), pref) * curr * c[i];
        }
        std::cout << answ * pow(Int(2), n) << std::endl;
    }
    return 0;
}

Measured memory_bytes: 3072