//
// Created by munaiyi on 2020/3/21.
//
#include <bits/stdc++.h>

using namespace std;

const int maxn = 2e5 + 5;
const int mod = 1e9 + 7;

int c[maxn];

int main() {
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", c + i);
    }
    sort(c, c + n, [](int x, int y) -> bool { return x > y; });
    long long ans = c[0];
    long long two = 1;
    for (int i = 1; i < n; i++) {
        ans = ans * 2;
        ans = (ans + (two * i % mod + two * 2) * c[i]) % mod;
        two = two * 2 % mod;
    }
    ans = ans * two * 2 % mod;
    printf("%lld\n", ans);
    return 0;
}
