#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
long mod=1e9+7;
long N;
long c[2<<17];
long F[2<<17],I[2<<17];
long power(long a,long b){return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;}
long C(long a,long b){return F[a]*I[b]%mod*I[a-b]%mod;}
int main()
{
	cin>>N;
	F[0]=1;
	for(long i=1;i<=N;i++)F[i]=F[i-1]*i%mod;
	I[N]=power(F[N],mod-2);
	for(long i=N-1;i>=0;i--)I[i]=I[i+1]*(i+1)%mod;
	for(int i=0;i<N;i++)
	{
		cin>>c[i];
	}
	sort(c,c+N);
	long N2=power(2,N);
	long ans=0;
	for(int i=0;i<N;i++)
	{
		long now=(N-i-1)*power(2,N-i-2)+power(2,N-i-1);
		now%=mod;
		ans+=N2*c[i]%mod*now%mod;
		N2=N2*2%mod;
	}
	cout<<ans%mod<<endl;
}