import java.util.*
import java.math.*

fun main(args: Array<String>) {

//    var N = readLine()!!.split(" ").map { it.toInt() }
    var N = readLine()!!.toInt()
//    val D = readLine()!!.split(" ").map { it.toLong() }
    val A = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    val mod = 1000000007L

    A.sort()
    var sum = 0
    var ans = mutableListOf<String>()

    if (N == 2) {
        var max = Math.max(A[0], A[1])
        var min = Math.min(A[0], A[1])
        println(max-min)
        println("${max} $min")
        return
    }


    if(A[0] > 0 && A[N-1] > 0) {

        var tmp = A[0] -A[1]

        ans.add("${A[0]} ${A[1]}")

        for (i in  2 until N-1){
            ans.add("${tmp} ${A[i]}")
            tmp -= A[i]
        }
        ans.add("${A[N-1]} ${tmp}")
        sum = A[N-1] - tmp

    }else if(A[0] < 0 && A[N-1] < 0) {
        var tmp = A[N-1] -A[N-2]
        ans.add("${A[N-1]} ${A[N-2]}")

        for (i in  2 until N){
            ans.add("${tmp} ${A[N-1-i]} ")
            tmp -= A[N-1-i]
        }
        sum = tmp

    }
    else{
        var f = A.first()
        var l = A.last()

        for (i in 1 until N - 1) {
            var a = A[i]
            if (a > 0) {
                ans.add("${f} ${a}")
                f -= a
            } else {
                ans.add("${l} ${a}")
                l -= a
            }
        }
        ans.add("${l} ${f}")
        sum = l - f
    }
    println(sum)
    println(ans.joinToString("\n"))

//    println("%.9f".format(ans))
}
