let m = 1000000007
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m

let rec power ( * ) e m n =
  if n <= 0 then e
  else power ( * ) (if n land 1 = 0 then e else m * e) (m * m) (n lsr 1)

let () = Scanf.scanf "%d\n" @@ fun n ->
  let cs = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun c -> c in
  Array.sort (fun c c' -> compare c' c) cs;
  Printf.printf "%d\n" @@
  ( *^ ) (power ( *^ ) 1 4 (n - 1)) @@
  Array.fold_left ( +^ ) 0 @@
  Array.init n @@ fun i -> (i + 2) *^ cs.(i)