N = gets.chomp.to_i
str = gets.split
p = Array.new(0)
m = Array.new(0)
z = Array.new(0)
a = 0
b = 0
c = 0
sum = 0
for x in 0...N
  a = str[x].to_i
  if a > 0
    p.push(a)
    sum += a
  elsif a < 0
    m.push(a)
    sum -= a
  else
    z.push(a)
  end
end

if p.size == 0
  if m.size == 0
    puts 0
    for x in 1...N
      puts "0 0"
    end
    exit
  elsif m.size == 1
    puts -m[0]
    for x in 1...N
      print m[0]," 0"
      puts
    end
    exit
  elsif z.size != 0
    puts sum
    b = z.pop
    c = m.pop
    print "0 ",c
    puts
    p.push(-c)
  else
    m.sort!
    c = m.pop
    m.reverse!
    b = m.pop
    sum += b*2
    puts sum
    print b," ",c
    puts
    p.push(b-c)
  end
elsif m.size == 0
  if p.size == 1
    puts p[0]
    for x in 1...N
      print m[0]," 0"
      puts
    end
    exit
  elsif z.size != 0
    puts sum
    b = z.pop
    c = p.pop
    print "0 ",c
    puts
    m.pop(-c)
  else
    p.sort!
    b = p.pop
    p.reverse!
    c = p.pop
    sum -= b*2
    puts sum
    print b," ",c
    puts
    m.push(b-c)
  end
else
  puts sum
end

b = p.pop
c = m.pop
while p.size > 0
  print c," ",b
  puts
  c -= b
  b = p.pop
end

while m.size > 0
  print b," ",c
  puts
  b -= c
  c = m.pop
end

print b," ",c
puts

for x in 1..z.size
  print b," 0"
  puts
end