//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;
#define int long long

const int MOD = 1000000007;

struct mint{
	ll x;
	mint(ll x=0) : x((x%MOD + MOD) % MOD){}
	mint& operator += (const mint a){
		if((x += a.x) >= MOD){
			x -= MOD;
		}
		return *this;
	}
	mint& operator -= (const mint a){
		if((x += MOD-a.x) >= MOD){
			x -= MOD;
		}
		return *this;
	}
	mint& operator *= (const mint a){
		(x *= a.x ) %= MOD;
		return *this;
	}
	mint operator + (const mint a) const{
		mint res(*this);
		return res +=a;
	}
	mint operator - (const mint a) const{
		mint res(*this);
		return res -=a;
	}
	mint operator * (const mint a) const{
		mint res(*this);
		return res *=a;
	}
	mint pow(ll t) const{
		if(!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if(t & 1) a *= *this;
		return a;
	}
	mint inv() const{
		return pow(MOD - 2);
	}
	mint& operator /= (const mint a){
		return (*this) *= a.inv();
	}
	mint operator /(const mint a) const{
		mint res(*this);
		return res/=a;
	}
};

//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int N;
  cin >> N;
  vector<int> C;
  C.resize(N);
  for(int i = 0 ; i < N; i++){
  	cin >> C[i];
  }
  sort(C.begin(),C.end());
  vector<mint> two(N + 1);
  two[0] = 1;
  for(int i = 0 ; i < N ; i++){
  	two[i+1] = two[i] * 2;
  }
  mint ans = 0;
  for(int i = 0 ; i < N; i++){
  	int l = i, r = N - 1 - i;
  	mint now = two[r];
  	if(r!=0)now += two[r-1] * r;
  	now *= two[l];
  	now *= C[i];
  	ans += now;
  }
  ans *= two[N];
  cout << ans.x << endl;
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 3328