#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <exception>
#include <stdexcept>

template <typename C>
void print_container(const C &c, const std::string &name)
{
  std::cout << name << ": ";
  std::for_each(c.cbegin(), c.cend(),
                [](auto &x) { std::cout << x << ", "; });
  std::cout << std::endl;
}

class ModComb {
public:
  /**
   * \param p prime number
   * \param max_table max number for table
   *
   * To calcurate nCk, n < max_table. For example,
   *   mc = ModComb(p, 1000)
   *   mc.combination(500, 100) is OK   (500 < 1000)
   *   mc.combination(10000, 100) is NG (10000 < 1000)
   */
  ModComb(uint64_t p, uint64_t max_table);

  uint64_t factorial(uint64_t n) const;
  uint64_t inverse(uint64_t n) const;
  uint64_t factorial_inverse(uint64_t n) const;

  uint64_t combination(uint64_t n, uint64_t k) const;
  uint64_t combination_large_n(uint64_t, uint64_t) const;

  /// (base ^ exp) % p
  uint64_t pow(uint64_t base, uint64_t exp);

private:
  const uint64_t p_, k_;
  // table for n!
  std::vector<uint64_t> factorial_;
  // table for n^(-1)
  std::vector<uint64_t> inverse_;
  // table for (n!)^(-1)
  std::vector<uint64_t> factorial_inverse_;
};

std::vector<int> n_ary(uint64_t decimal, uint64_t base)
{
  uint64_t s = decimal;
  std::vector<int> ret;
  while(s >= base) {
    int r = s % base;
    s /= base;
    ret.push_back(r);
  }
  ret.push_back(s);

  std::reverse(ret.begin(), ret.end());
  return ret;
}

ModComb::ModComb(uint64_t p, uint64_t k)
    : p_(p), k_(k)
{
  if(p < k) {
    throw std::runtime_error("ModComb: p < k (must k <= p");
  }

  factorial_.resize(k_ + 1);
  inverse_.resize(k_ + 1);
  factorial_inverse_.resize(k_ + 1);

  factorial_[0] = factorial_[1] = 1;
  inverse_[0] = inverse_[1] = 1;
  factorial_inverse_[0] = factorial_inverse_[1] = 1;
  for(uint64_t i=2; i<=k_; i++) {
    factorial_[i] = (i * factorial_[i-1]) % p_;
    int64_t a = - (p_/i) * inverse_[p_ % i];
    while(a<0) {
      a += p_;
    }
    inverse_[i] = a % p_;
    factorial_inverse_[i] = (inverse_[i] * factorial_inverse_[i-1]) % p_;
  }
}

uint64_t ModComb::factorial(uint64_t n) const
{
  if(k_ < n) {
    throw std::runtime_error("factorial: too large n (must n <= k)");
  }
  return factorial_[n];
}

uint64_t ModComb::inverse(uint64_t n) const
{
  if(k_ < n) {
    throw std::runtime_error("inverse: too large n (must n <= k)");
  }
  return inverse_[n];
}

uint64_t ModComb::factorial_inverse(uint64_t n) const
{
  if(k_ < n) {
    throw std::runtime_error("factorial_inverse: too large n (must n <= k)");
  }
  return factorial_inverse_[n];
}

uint64_t ModComb::combination(uint64_t n, uint64_t k) const
{
  if(n < k) {
    throw std::runtime_error("combination: error: n < k (must k < n)");
  }
  if(k_ < n) {
    return combination_large_n(n, k);
  }

  return (((factorial_[n] * factorial_inverse_[n-k]) % p_) * factorial_inverse_[k]) % p_;
}

uint64_t ModComb::combination_large_n(uint64_t n, uint64_t k) const
{
  if(n < k_) {
    return combination(n, k);
  }

  uint64_t ret = 1;

  if(k > n/2) {
    k = n - k;
  }

  for(uint64_t i=0; i<k; i++) {
    ret *= n - i;
    ret %= p_;
  }
  ret *= factorial_inverse(k);
  ret %= p_;

  return ret;
}


uint64_t ModComb::pow(uint64_t base, uint64_t exp)
{
  // for fast calcuration, calc as following.
  //   ret = base
  //   ret *= ret; // base ** 2
  //   ret *= ret; // base ** 4
  //   ret *= ret; // base ** 8
  //   and so on
  // To avoid remaining loop, we change exp to binary exp,
  // and cache `base ** N` result.
  //
  // ex) base = 3, exp = 10 i.e we want 3**10.
  //  10 = 1010, we calcurate 3^8 and 3^2, then 3^8 * 3^2

  if(exp == 0) {
    return 1;
  }

  std::vector<int> binexp = n_ary(exp, 2);
  std::reverse(binexp.begin(), binexp.end());
  uint64_t ret = 1;
  uint64_t tmp = base; // base, base^2, base^4, ...

  for(auto i: binexp) {
    if(i==1) {
      ret *= tmp;
      ret %= p_;
    }
    tmp *= tmp;
    tmp %= p_;
  }

  return ret;
}

int main()
{
  uint64_t N;
  std::cin >> N;
  std::vector<uint64_t> C(N);

  for(uint64_t i=0; i<N; i++) {
    std::cin >> C[i];
  }
  std::sort(C.begin(), C.end());
  // print_container(C, "C");

  constexpr const uint64_t p = std::pow(10, 9) + 7;

  // pow(2, 2N-1);
  uint64_t pow2 = 1;
  for(uint64_t l=0; l<N-1; l++) {
    pow2 *= 2;
    pow2 %= p;
    pow2 *= 2;
    pow2 %= p;
  }

  uint64_t ret = 0;
  for(uint64_t l=0; l<N; l++) {
    uint64_t r = N - l + 1;
    r *= C[l];
    r %= p;

    ret += r;
    ret %= p;
  }

  ret *= pow2;
  ret %= p;

  std::cout << ret << std::endl;
  return 0;
}


Measured memory_bytes: 4828