local mab = math.abs
local n = io.read("*n")
local a = {}
local sum = 0
local abssum = 0
for i = 1, n do
  a[i] = io.read("*n")
  sum = sum + a[i]
  abssum = abssum + mab(a[i])
end
table.sort(a)
local allplus = 0 <= a[1]
local allminus = a[n] < 0

if n == 2 then
  if a[1] < a[2] then
    print(a[2] - a[1])
    print(a[2] .. " " .. a[1])
  else
    print(a[1] - a[2])
    print(a[1] .. " " .. a[2])
  end
else
  if allplus then
    print(sum - a[1] * 2)
    local cur = a[1]
    for i = 2, n - 1 do
      print(cur .. " " .. a[i])
      cur = cur - a[i]
    end
    print(a[n] .. " " .. cur)
  elseif allminus then
    print(a[n] * 2 - sum)
    local cur = a[n]
    for i = 1, n - 1 do
      print(cur .. " " .. a[i])
      cur = cur - a[i]
    end
  else
    print(abssum)
    local minlast = 1
    for i = 1, n do
      if a[i] < 0 then
        minlast = i
      else
        break
      end
    end
    local cur = a[minlast]
    for i = minlast + 1, n - 1 do
      print(cur .. " " .. a[i])
      cur = cur - a[i]
    end
    print(a[n] .. " " .. cur)
    cur = a[n] - cur
    for i = 1, minlast - 1 do
      print(cur .. " " .. a[i])
      cur = cur - a[i]
    end
  end
end
