n = gets.to_i
a = gets.split.map(&:to_i).sort

ary = []
i = a.index {|e| e >= 0}

if i.nil?
    m = a[-1]
    a[0..-2].each do |e|
        ary << "#{m} #{e}"
        m -= e
    end
elsif i == 0
    m = a[0]
    a[1..-2].each do |e|
        ary << "#{m} #{e}"
        m -= e
    end
    ary << "#{a[-1]} #{m}"
    m = a[-1] - m
else
    m = a[0]
    a[i..-2].each do |e|
        ary << "#{m} #{e}"
        m -= e
    end
    ary << "#{a[-1]} #{m}"
    m = a[-1] - m
    a[1..i-1].each do |e|
        ary << "#{m} #{e}"
        m -= e
    end
end

puts m, ary