import java.util.*

fun main(args: Array<String>) {
	val scanner = Scanner(System.`in`)
	val n = scanner.nextInt()
	val pa = mutableListOf<Int>()
	val na = mutableListOf<Int>()
	for(i in 0..n-1){
		val a = scanner.nextInt()
		if (a>=0) pa.add(a) else na.add(a)
	}
	pa.sort()
	na.sort()
	val seq = mutableListOf<Pair<Int, Int>>()
	if (pa.size==0){
		if (na.size>2) {
			seq.add(Pair(na[na.size - 1], na[na.size - 2]))
			pa.add(na[na.size - 1] - na[na.size - 2])
			na.removeAt(na.size - 1)
			na.removeAt(na.size - 2)
		}else {
			println(na[1]-na[0])
			println("${na[1]} ${na[0]}")
			System.exit(0)
		}
	}else if (na.size==0){
		if (pa.size>2){
			seq.add(Pair(pa[0], pa[1]))
			na.add(pa[0]-pa[1])
			pa.removeAt(1)
			pa.removeAt(0)
		}else {
			println(pa[1]-pa[0])
			println("${pa[1]} ${pa[0]}")
			System.exit(0)
		}
	}
	for (i in 1..na.lastIndex){
		seq.add(Pair(pa.last(), na[i]))
		pa[pa.lastIndex] -= na[i]
	}
	for (i in 0..pa.lastIndex-1){
		seq.add(Pair(na[0], pa[i]))
		na[0] -= pa[i]
	}
	seq.add(Pair(pa.last(), na[0]))
	println(pa.last()-na[0])
	seq.forEach { println("${it.first} ${it.second}") }

}