n = gets.to_i
minus_numbers = []
plus_numbers = []
numbers = gets.split(" ").map(&:to_i)

if n == 2
  if numbers[0] > numbers[1]
    puts numbers[0] - numbers[1]
    puts "#{numbers[0]} #{numbers[1]}"
    exit
  else
    puts numbers[1] - numbers[0]
    puts "#{numbers[1]} #{numbers[0]}"
    exit
  end
end

numbers.each do |n|
  if n >= 0
    plus_numbers << n
  else
    minus_numbers << n
  end
end

plus_numbers.sort!.reverse!
minus_numbers.sort!

flag = false

if minus_numbers.length == 0
  tmp_a = plus_numbers.pop
  tmp_b = plus_numbers.pop
  minus_numbers << tmp_a - tmp_b
  flag = true
end

if plus_numbers.length == 0
  tmp_a = minus_numbers.pop
  tmp_b = minus_numbers.pop
  plus_numbers << tmp_a - tmp_b
  flag = true
end

answers = []

if flag == true
  answers << [tmp_a, tmp_b]
end

calc_number = minus_numbers.pop

plus_numbers.each_with_index do |plus_number, index|
  if index != plus_numbers.length - 1
    answers << [calc_number, plus_number]
    calc_number = calc_number - plus_number
  else
    answers << [plus_number, calc_number]
    calc_number = plus_number - calc_number
  end
end

minus_numbers.each do |minus_number|
  answers << [calc_number, minus_number]
  calc_number = calc_number - minus_number
end

puts calc_number

answers.each do |answer|
  puts "#{answer[0]} #{answer[1]}"
end