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: # import math
  # import fractions
  # import numpy as np
  
  # MOD = 10 ** 9 + 7
  
  # ゼロ埋め
  # list = [0] * N
  
  # 二次元配列
  # [[inf, inf, inf], [inf, inf, inf]]
  # dp = [[float('inf')] * (H + 1) for i in range(N + 1)]
  
  
  def solve(N, A):
      A.sort()
      two = [0] * (N + 1)
      for i in range(N + 1):
          two[i] = 2**i
  
      ans = 0
      for i in range(N):
          l = i
          r = N - i - 1
          now = two[r]
          if r != 0:
              now += two[r - 1] * r
          now *= two[l]
          now *= A[i]
          ans += now
  
      ans *= two[N]
  
      return ans
  
      return 0
  
  
  # S = input()
  N = int(input())
  # H, N = map(int, input().split())
  A = list(map(int, input().split()))
  # B = [int(input()) for _ in range(n)]
  # A = []
  # B = []
  # for _ in range(N):
  #     a, b = list(map(int, input().split()))
  #     A.append(a)
  #     B.append(b)
  
  print(solve(N, A))
  
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"}]