#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
const LL mod = 1e9+7;
const int SIZEN = 200010;
LL pw[SIZEN];
LL C[SIZEN];
int N;
int main(){
    scanf("%d",&N);
    pw[0] = 1;
    for(int i = 1;i <= N;i++)pw[i] = pw[i-1] * 2 % mod;
    for(int i = 1;i <= N;i++)scanf("%lld",&C[i]);
    sort(C+1,C+1+N);
    LL ans = 0;
    for(int i = 1;i <= N;i++){
        ans = (ans + C[i] * pw[i-1] % mod * pw[N]%mod * ( (N-i)  * pw[max(N-i-1,0)]%mod + pw[N-i] ) % mod ) % mod;
    }
    printf("%lld\n",ans);
    return 0;
}