N = gets.to_i
as = gets.split.map(&:to_i)
as.sort!
ans = []
min = as.shift
max = as.pop
 
tmp1 = min
while as.size > 0 && as[-1].to_i >= 0
  plus = as.pop
  ans << [tmp1, plus]
  tmp1 -= plus
end
tmp2 = max
while as.size > 0 && as[-1].to_i < 0
  minus = as.pop
  ans << [tmp2, minus]
  tmp2 -= minus
end
ans << [tmp2, tmp1]
p tmp2 - tmp1

ans.map { |(x, y)| puts "#{x} #{y}" }