n = gets.to_i
ary = gets.split.map(&:to_i)
positive = ary.select(&:positive?).sort
negative = ary.select(&:negative?).sort
if positive.empty?
  positive[0] = negative[-1]
  negative.delete_at(-1)
end
if negative.empty?
  negative[0] = positive[0]
  positive.delete_at(0)
end

result = []

positive[0..-2].each do |i|
  result.push("#{negative[0]} #{i}")
  negative[0] -= i
end
negative.each do |i|
  result.push("#{positive[-1]} #{i}")
  positive[-1] -= i
end

puts positive[-1]
puts result