N = gets.to_i
arr = gets.split.map(&:to_i)

if N == 2
  puts arr.max - arr.min
  puts "#{arr.max} #{arr.min}"
else
  logs = []

  arr.sort!
  min = arr.shift
  max = arr.pop
  arr.each do |i|
    if i > 0
      logs.push([min, i])
      min -= i
    else
      logs.push([max, i])
      max -= i
    end
  end
  puts max - min
  logs.each { |log| puts "#{log[0]} #{log[1]}"}
  puts "#{max} #{min}"
end
