n = gets.to_i
a = gets.split.map(&:to_i).sort
if a[1] >= 0
    s = a[0]
    ans = a.inject(:+)-2*a[0]
    puts ans
    (1..(n-2)).each do |i|
        puts "#{s} #{a[i]}"
        s -= a[i]
    end
    puts "#{a[-1]} #{s}"
else
    j = -1
    n.times do |i|
        if a[i] >= 0
            j = i
            break
        end
    end
    if j == -1
        ans = -a.inject(:+)+2*a[-1]
        puts ans
        s = a[-1]
        (0..(n-2)).each do |i|
            puts "#{s} #{a[i]}"
            s -= a[i]
        end
    else
        ans = -a[0...j].inject(:+)+a[j...n].inject(:+)
        puts ans
        s = a[0]
        (j..(n-2)).each do |i|
            puts "#{s} #{a[i]}"
            s -= a[i]
        end
        a[0] = s
        t = a[-1]
        j.times do |i|
            puts "#{t} #{a[i]}"
            t -= a[i]
        end
    end
end