n = int(input())
A = sorted(map(int, input().split()))
L = []
if A[0] >= 0:
  x = A[0]
  for i in range(1, n-1):
    L.append((x, A[i]))
    x -= A[i]
  L.append((A[-1], x))
  M = A[-1] - x
elif A[-1] < 0:
  x = A[-1]
  for i in range(1, n):
    L.append((x, A[n-1-i]))
    x -= A[n-1-i]
  M = x
else:
  for i in range(n):
    if A[i] >= 0:
      border = i
      break
  for i in range(border, n-1):
    L.append((A[0], A[i]))
    A[0] -= A[i]
  x = A[-1]
  for i in range(border):
    L.append((x, A[i]))
    x -= A[i]
  M = x
  
print(M)
for x, y in L:
  print(x, y) n = int(input()) n int(input()) int input() input A = sorted(map(int, input().split())) A sorted(map(int, input().split())) sorted map(int, input().split()) map int input().split() ().split () input split L = [] L [] if A[0] >= 0:
  x = A[0]
  for i in range(1, n-1):
    L.append((x, A[i]))
    x -= A[i]
  L.append((A[-1], x))
  M = A[-1] - x
elif A[-1] < 0:
  x = A[-1]
  for i in range(1, n):
    L.append((x, A[n-1-i]))
    x -= A[n-1-i]
  M = x
else:
  for i in range(n):
    if A[i] >= 0:
      border = i
      break
  for i in range(border, n-1):
    L.append((A[0], A[i]))
    A[0] -= A[i]
  x = A[-1]
  for i in range(border):
    L.append((x, A[i]))
    x -= A[i]
  M = x
   A[0] >= 0 A[0] A 0 0 x = A[0] x A[0] A 0 for i in range(1, n-1):
    L.append((x, A[i]))
    x -= A[i]
   i range(1, n-1) range 1 n-1 n 1 L.append((x, A[i])) L.append L append (x, A[i]) x A[i] A i x -= A[i] x A[i] A i L.append((A[-1], x)) L.append L append (A[-1], x) A[-1] A -1 x M = A[-1] - x M A[-1] - x A[-1] A -1 x elif A[-1] < 0:
  x = A[-1]
  for i in range(1, n):
    L.append((x, A[n-1-i]))
    x -= A[n-1-i]
  M = x A[-1] < 0 A[-1] A -1 0 x = A[-1] x A[-1] A -1 for i in range(1, n):
    L.append((x, A[n-1-i]))
    x -= A[n-1-i]
   i range(1, n) range 1 n L.append((x, A[n-1-i])) L.append L append (x, A[n-1-i]) x A[n-1-i] A n-1-i n-1 n 1 i x -= A[n-1-i] x A[n-1-i] A n-1-i n-1 n 1 i M = x M x for i in range(n):
    if A[i] >= 0:
      border = i
      break
   i range(n) range n if A[i] >= 0:
      border = i
      break
   A[i] >= 0 A[i] A i 0 border = i border i break for i in range(border, n-1):
    L.append((A[0], A[i]))
    A[0] -= A[i]
   i range(border, n-1) range border n-1 n 1 L.append((A[0], A[i])) L.append L append (A[0], A[i]) A[0] A 0 A[i] A i A[0] -= A[i] A[0] A 0 A[i] A i x = A[-1] x A[-1] A -1 for i in range(border):
    L.append((x, A[i]))
    x -= A[i]
   i range(border) range border L.append((x, A[i])) L.append L append (x, A[i]) x A[i] A i x -= A[i] x A[i] A i M = x M x print(M) print M for x, y in L:
  print(x, y) x y L print(x, y) print x y border = i i border L = [] [] L M = A[-1] - x A[-1] - x M A = sorted(map(int, input().split())) sorted(map(int, input().split())) A x = A[-1] A[-1] x x -= A[i] A[i] x x = A[0] A[0] x M = x x M n = int(input()) int(input()) n x -= A[i] A[i] x x -= A[n-1-i] A[n-1-i] x M = x x M x = A[-1] A[-1] x
n = int(input())
A = sorted(map(int, input().split()))
L = []
if A[0] >= 0:
  x = A[0]
  for i in range(1, n-1):
    L.append((x, A[i]))
    x -= A[i]
  L.append((A[-1], x))
  M = A[-1] - x
elif A[-1] < 0:
  x = A[-1]
  for i in range(1, n):
    L.append((x, A[n-1-i]))
    x -= A[n-1-i]
  M = x
else:
  for i in range(n):
    if A[i] >= 0:
      border = i
      break
  for i in range(border, n-1):
    L.append((A[0], A[i]))
    A[0] -= A[i]
  x = A[-1]
  for i in range(border):
    L.append((x, A[i]))
    x -= A[i]
  M = x
  
print(M)
for x, y in L:
  print(x, y)