output_description: Print the sum of f(S, T), modulo (10^9+7).
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      C_1 C_2 \cdots C_N
attempt: # -*- coding: utf-8 -*-
  
  import sys
  
  
  def input():
      return sys.stdin.readline().strip()
  
  
  def list2d(a, b, c):
      return [[c] * b for i in range(a)]
  
  
  def list3d(a, b, c, d):
      return [[[d] * c for j in range(b)] for i in range(a)]
  
  
  def list4d(a, b, c, d, e):
      return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
  
  
  def ceil(x, y=1):
      return int(-(-x // y))
  
  
  def INT():
      return int(input())
  
  
  def MAP():
      return map(int, input().split())
  
  
  def LIST(N=None):
      return list(MAP()) if N is None else [INT() for i in range(N)]
  
  
  def Yes():
      print("Yes")
  
  
  def No():
      print("No")
  
  
  def YES():
      print("YES")
  
  
  def NO():
      print("NO")
  
  
  sys.setrecursionlimit(10**9)
  INF = 10**18
  MOD = 10**9 + 7
  
  
  def fermat(x, y, MOD):
      return x * pow(y, MOD - 2, MOD) % MOD
  
  
  N = INT()
  A = LIST()
  
  # 大きい数ほど少なく使うのが最適なので降順ソートしておく
  A.sort(reverse=1)
  # 各要素が変更のために何回使われるか数える
  cnts = [0] * N
  cnts[0] = pow(4, N - 1, MOD)
  add = fermat(cnts[0], 2, MOD)
  for i in range(1, N):
      cnts[i] = cnts[i - 1] + add
      cnts[i] %= MOD
  
  ans = 0
  for i in range(N):
      ans += A[i] * cnts[i]
      ans %= MOD
  print(ans * 2 % MOD)
  
problem_description: Statement
  
  For two sequences S and T of length N consisting of 0 and 1, let us define
  f(S, T) as follows:
  
    * Consider repeating the following operation on S so that S will be equal to T. f(S, T) is the minimum possible total cost of those operations.
  
      * Change S_i (from 0 to 1 or vice versa). The cost of this operation is D \times C_i, where D is the number of integers j such that S_j \neq T_j (1 \leq j \leq N) just before this change.
  
  There are 2^N \times (2^N - 1) pairs (S, T) of different sequences of length N
  consisting of 0 and 1. Compute the sum of f(S, T) over all of those pairs,
  modulo (10^9+7).
samples: [{"input": "1\n    1000000000", "output": "999999993\n    \n\nThere are two pairs (S, T) of different sequences of length 2 consisting of 0\nand 1, as follows:\n\n  * S = (0), T = (1): by changing S_1 to 1, we can have S = T at the cost of 1000000000, so f(S, T) = 1000000000.\n  * S = (1), T = (0): by changing S_1 to 0, we can have S = T at the cost of 1000000000, so f(S, T) = 1000000000.\n\nThe sum of these is 2000000000, and we should print it modulo (10^9+7), that\nis, 999999993.\n\n* * *"}, {"input": "2\n    5 8", "output": "124\n    \n\nThere are 12 pairs (S, T) of different sequences of length 3 consisting of 0\nand 1, which include:\n\n  * S = (0, 1), T = (1, 0)\n\nIn this case, if we first change S_1 to 1 then change S_2 to 0, the total cost\nis 5 \\times 2 + 8 = 18. We cannot have S = T at a smaller cost, so f(S, T) =\n18.\n\n* * *"}, {"input": "5\n    52 67 72 25 79", "output": "269312"}]