import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop;

immutable long MOD = 10^^9 + 7;

void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;
    A.sort!"a > b";

    long ans = 0;

    foreach (i; 0..N) {
        long left = i == 0 ? 1L : (i + 2) * powmod(2, i - 1, MOD) % MOD;
        left = left * powmod(2, i, MOD) % MOD;
        long right = powmod(4, N - i - 1, MOD);
        (ans += left * right % MOD * A[i] % MOD * 2 % MOD) %= MOD;
    }

    ans.writeln;
}

long powmod(long a, long x, long m) {
    long ret = 1;
    while (x) {
        if (x % 2) ret = ret * a % m;
        a = a * a % m;
        x /= 2;
    }
    return ret;
}
