// Reads multiple ints in a line, separate by a space.
// It works even if the actual number of ints is smaller than n.
// WARNING: This function does not work for -2^31.
// NOTE: This function does not handle error cases.
fun fastReadInts(n: Int): IntArray {
    val xs = IntArray(n)
    val s = readLine()!!
    var currentValue = 0
    var isNegative = false
    var currentIndex = 0
    for (c in s) {
        if (c == ' ') {
            xs[currentIndex] = currentValue * if (isNegative) -1 else 1
            currentValue = 0
            isNegative = false
            currentIndex++
        } else if (c == '-') {
            isNegative = true
        } else {
            currentValue *= 10
            currentValue += c - '0'
        }
    }
    xs[currentIndex] = currentValue * if (isNegative) -1 else 1
    return xs
}

fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val xs = fastReadInts(n)
    xs.sortDescending()

    val output = StringBuilder()
    if (xs.all { it >= 0 }) {
        for (i in 1..(n - 2)) {
            output.append("${xs[n - 1]} ${xs[i]}\n")
            xs[n - 1] = xs[n - 1] - xs[i]
        }
        output.append("${xs[0]} ${xs[n - 1]}\n")
        xs[0] = xs[0] - xs[n - 1]
        println(xs[0])
        print(output)
    } else if (xs.all { it < 0 }) {
        for (i in 1..(n - 1)) {
            output.append("${xs[0]} ${xs[i]}\n")
            xs[0] = xs[0] - xs[i]
        }
        println(xs[0])
        print(output)
    } else {
        val firstNegativeIndex = xs.indexOfFirst { it < 0 }
        for (i in 1 until firstNegativeIndex) {
            output.append("${xs[n - 1]} ${xs[i]}\n")
            xs[n - 1] = xs[n - 1] - xs[i]
        }
        for (i in firstNegativeIndex until n) {
            output.append("${xs[0]} ${xs[i]}\n")
            xs[0] = xs[0] - xs[i]
        }
        println(xs[0])
        print(output)
    }
}