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