import java.io.PrintWriter
val pw = PrintWriter(System.out)
fun main(args: Array<String>) {
    func()
    pw.flush()
}
fun print(value: Any) { pw.print(value) }
fun println(value: Any) { pw.println(value) }

fun func() {
    val N = nextInt()
    val A = listOfInt().toIntArray().sortedDescending().toMutableList()
    val output = StringBuilder()
    if (A.all { it >= 0 }) {
        for (i in 1..(N - 2)) {
            output.append("${A[N - 1]} ${A[i]}\n")
            A[N - 1] = A[N - 1] - A[i]
        }
        output.append("${A[0]} ${A[N - 1]}\n")
        A[0] = A[0] - A[N - 1]
        println(A[0])
        print(output)
    } else if (A.all { it < 0 }) {
        for (i in 1..(N - 1)) {
            output.append("${A[0]} ${A[i]}\n")
            A[0] = A[0] - A[i]
        }
        println(A[0])
        print(output)
    } else {
        val fni = A.indexOfFirst { it < 0 }
        for (i in 1 until fni) {
            output.append("${A[N - 1]} ${A[i]}\n")
            A[N - 1] = A[N - 1] - A[i]
        }
        for (i in fni until N) {
            output.append("${A[0]} ${A[i]}\n")
            A[0] = A[0] - A[i]
        }
        println(A[0])
        print(output)
    }
}

fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
