local n = io.read("*n")
local p, m = {}, {}
for i = 1, n do
  local a = io.read("*n")
  if 0 <= a then
    table.insert(p, a)
  else
    table.insert(m, a)
  end
end
table.sort(p)
table.sort(m, function(a, b) return a > b end)
local v = 0
local r1, r2 = {}, {}
if #m == 0 then
  v = p[1]
  for i = 3, #p do
    table.insert(r1, v)
    table.insert(r2, p[i])
    v = v - p[i]
  end
  table.insert(r1, p[2])
  table.insert(r2, v)
  v = p[2] - v
elseif #p == 0 then
  v = m[1]
  for i = 2, #m do
    table.insert(r1, v)
    table.insert(r2, m[i])
    v = v - m[i]
  end
else
  v = m[1]
  for i = 2, #p do
    table.insert(r1, v)
    table.insert(r2, p[i])
    v = v - p[i]
  end
  table.insert(r1, p[1])
  table.insert(r2, v)
  v = p[1] - v
  for i = 2, #m do
    table.insert(r1, v)
    table.insert(r2, m[i])
    v = v - m[i]
  end
end
print(v)
for i = 1, n - 1 do
  print(r1[i] .. " " ..r2[i])
end
