def main(argv)
  n = gets.chomp.to_i
  a = gets.chomp.split(' ').map(&:to_i).sort
  
  s = a.reduce(:+)
  
  q = a.bsearch_index{|x| x >= 0}
  # p q # <-- debug
  
  if q == nil then # a is all negative
    q = n - 1
  elsif q == 0  then # a is all positive
    q = 1
  end
  
  m = a[q..n].reduce(:+) - a[0..q-1].reduce(:+)
  puts m.to_s
  
  a[q..n-2].each do |y|
    puts [a[0], y].map(&:to_s).join(' ')
    a[0] -= y
  end
  
  a[0..q-1].each do |y|
    puts [a[n-1], y].map(&:to_s).join(' ')
    a[n-1] -= y
  end
end

if self.to_s == 'main' then
  main(ARGV)
end