let n = read_int ()
let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun i -> i))
let m = (n - 1) / 2

let rec f ans i =
  if i <> m then f (ans + a.(i) * 2) (i - 1)
  else if n mod 2 = 1 then ans + a.(m)
  else ans

let () =
  Array.sort (fun x y -> x - y) a;
  let ans = f a.(n - 1) (n - 2) in
  Printf.printf "%d\n" ans
