#include <iostream>
#include <cstdio>
#include <algorithm>
#define N 200005
using namespace std;

typedef long long ll;
ll M = 1e9 + 7;
ll n, s, ans, po[N]{1}, c[N];
int main()
{
	ll i;
	cin >> n;
	for (i = 1; i <= n; i++) {
		po[i] = po[i - 1] * 2 % M;
	}
	for (i = 0; i < n; i++) scanf("%lld", &c[i]);
	sort(c, c + n);
	s = po[n - 1];
	for (i = n - 1; i >= 0; i--) {
		ans = (ans + s * c[i]) % M;
		s = (s + po[n - 2]) % M;
	}
    cout << ans * po[n] % M << endl;
    return 0;
}