import java.util.Scanner

import scala.io.StdIn._

object Main extends App {

  val n = readInt()
  val A = readLine().split(" ").map(_.toInt)

  def solve() = {
    val sorted = A.sorted(Ordering[Int].reverse)

    var ans = 0
    var i = 0
    while(i < n-1) {
      if(i == 0) {
        ans += sorted(i)
        i += 1
      } else {
        val addTimes = if(n-1-i >= 2) 2 else 1
        ans += sorted(i) * addTimes
        i += 2
      }
    }
    ans
  }


  println(solve())

}

