object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n = sc.nextInt()
  val a = Array.fill(n)(sc.nextLong()).sorted.reverse
  var ans = a(0)
  ans += a.slice(1, (n-1)/2 + 1).sum * 2
  if (n % 2 == 1) {
    ans -= a((n-1)/2)
  }
  println(ans)
}
