N = gets.to_i
a = gets.split.map(&:to_i)
pl = []
mi = []
a.each do |v|
  if v > 0
    pl << v
  else
    mi << v
  end
end
opr = []
if pl.length > 0 && mi.length > 0
  mi.sort!
  if mi.length > 1
    (mi.length-1).times do |i|
      opr << [pl[0],mi[i+1]]
      pl[0] -= mi[i+1]
    end
  end
  if pl.length > 1
    (pl.length-1).times do |i|
      opr << [mi[0],pl[i+1]]
      mi[0] -= pl[i+1]
    end
  end
  opr << [pl[0],mi[0]]
  ans = pl[0]-mi[0]
elsif pl.length == 0
  mi.sort!
  (mi.length-1).times do |i|
    opr << [mi[-1],mi[i]]
    mi[-1] -= mi[i]
  end
  ans = mi[-1]
elsif pl.length >= 3
  pl.sort.reverse!
  (pl.length-2).times do |i|
    opr << [pl[0],pl[i+1]]
    pl[0] -= pl[i+1]
  end
  opr << [pl[-1],pl[0]]
  ans = pl[-1] - pl[0]
else
  pl.sort!
  opr << [pl[1],pl[0]]
  ans = pl[1]-pl[0]
end
puts ans
opr.each do |x,y|
  puts "#{x} #{y}"
end