fun main() {
    val n = readInt()
    val a = readLongs().sortedDescending()

    val score = mutableListOf<Long>()
    score.add(0)
    score.add(a[0])
    for (i in 1 until n) {
        score.add(a[i])
        score.add(a[i])
    }

    println(score.take(n).sum())
}

private fun readInt() = readLine()!!.toInt()
private fun readInts() = readLine()!!.split(" ").map { it.toInt() }
private fun readLongs() = readLine()!!.split(" ").map { it.toLong() }
