n = gets.to_i
a = gets.split(" ").map{|k|k.to_i}
a = a.sort
if a[0]<0 && a[-1]<0 then
    d = a[-1]
    sum = 0
    a.map{|s| sum += s.abs}
    sum = sum - 2*d
elsif a[0]>0 && a[-1]>0 then
    d = a[0]
    sum = 0
    a.map{|s| sum += s.abs}
    sum = sum - 2*d
else
    sum = 0
    a.map{|s| sum += s.abs}
end
puts sum
i = 0
while a[1] < 0
    puts "#{a[-1]} #{a[0]}"
    a[-1] = a[-1]-a[0]
    a.shift
    n -=1
end
ans_num = a[0]
if a.size-2 > 0 then
(a.size-2).times{|k|
    puts "#{ans_num} #{a[n-1-1-k]}"
    ans_num = ans_num-a[n-1-1-k]
}
end
puts "#{a[-1]} #{ans_num}"