N = int(input())
A = list(map(int, input().split()))
A.sort()
M = A[0]
X = [A[0]]
pos = N
for i in range(N):
  if A[i] >= 0:
    pos = i
    break
if pos == 0:
  for i in range(1, N - 1):
    M -= A[i]
    X.append(M)
  S = M
  M = A[N-1] - M
  print(M)
  for i in range(N - 2):
    print(X[i], A[i+1])
  print(A[N - 1], S)
elif 1 <= pos <= N - 1:
  M = sum(abs(_) for _ in A)
  print(M)
  L = A[0]
  for j in range(pos, N - 1):
    print(L, A[j])
    L -= A[j]
  R = A[N - 1]
  print(R, L)
  R -= L
  for j in range(1, pos):
    print(R, A[j])
    R -= A[j]
elif pos == N:
  print(A[N-1] - sum(A[i] for i in range(N-1)))
  R = A[N - 1]
  for i in range(N-1):
    print(R, A[i])
    R -= A[i] N = int(input()) N int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A.sort() A.sort A sort M = A[0] M A[0] A 0 X = [A[0]] X [A[0]] A[0] A 0 pos = N pos N for i in range(N):
  if A[i] >= 0:
    pos = i
    break i range(N) range N if A[i] >= 0:
    pos = i
    break A[i] >= 0 A[i] A i 0 pos = i pos i break if pos == 0:
  for i in range(1, N - 1):
    M -= A[i]
    X.append(M)
  S = M
  M = A[N-1] - M
  print(M)
  for i in range(N - 2):
    print(X[i], A[i+1])
  print(A[N - 1], S)
elif 1 <= pos <= N - 1:
  M = sum(abs(_) for _ in A)
  print(M)
  L = A[0]
  for j in range(pos, N - 1):
    print(L, A[j])
    L -= A[j]
  R = A[N - 1]
  print(R, L)
  R -= L
  for j in range(1, pos):
    print(R, A[j])
    R -= A[j]
elif pos == N:
  print(A[N-1] - sum(A[i] for i in range(N-1)))
  R = A[N - 1]
  for i in range(N-1):
    print(R, A[i])
    R -= A[i] pos == 0 pos 0 for i in range(1, N - 1):
    M -= A[i]
    X.append(M)
   i range(1, N - 1) range 1 N - 1 N 1 M -= A[i] M A[i] A i X.append(M) X.append X append M S = M S M M = A[N-1] - M M A[N-1] - M A[N-1] A N-1 N 1 M print(M) print M for i in range(N - 2):
    print(X[i], A[i+1])
   i range(N - 2) range N - 2 N 2 print(X[i], A[i+1]) print X[i] X i A[i+1] A i+1 i 1 print(A[N - 1], S) print A[N - 1] A N - 1 N 1 S elif 1 <= pos <= N - 1:
  M = sum(abs(_) for _ in A)
  print(M)
  L = A[0]
  for j in range(pos, N - 1):
    print(L, A[j])
    L -= A[j]
  R = A[N - 1]
  print(R, L)
  R -= L
  for j in range(1, pos):
    print(R, A[j])
    R -= A[j] 1 <= pos <= N - 1 1 <= pos 1 pos N - 1 N 1 M = sum(abs(_) for _ in A) M sum(abs(_) for _ in A) sum abs(_) abs _ print(M) print M L = A[0] L A[0] A 0 for j in range(pos, N - 1):
    print(L, A[j])
    L -= A[j]
   j range(pos, N - 1) range pos N - 1 N 1 print(L, A[j]) print L A[j] A j L -= A[j] L A[j] A j R = A[N - 1] R A[N - 1] A N - 1 N 1 print(R, L) print R L R -= L R L for j in range(1, pos):
    print(R, A[j])
    R -= A[j] j range(1, pos) range 1 pos print(R, A[j]) print R A[j] A j R -= A[j] R A[j] A j elif pos == N:
  print(A[N-1] - sum(A[i] for i in range(N-1)))
  R = A[N - 1]
  for i in range(N-1):
    print(R, A[i])
    R -= A[i] pos == N pos N print(A[N-1] - sum(A[i] for i in range(N-1))) print A[N-1] - sum(A[i] for i in range(N-1)) A[N-1] A N-1 N 1 sum(A[i] for i in range(N-1)) sum A[i] A i R = A[N - 1] R A[N - 1] A N - 1 N 1 for i in range(N-1):
    print(R, A[i])
    R -= A[i] i range(N-1) range N-1 N 1 print(R, A[i]) print R A[i] A i R -= A[i] R A[i] A i A = list(map(int, input().split())) list(map(int, input().split())) A M = sum(abs(_) for _ in A) sum(abs(_) for _ in A) M R -= A[i] A[i] R S = M M S M = A[0] A[0] M N = int(input()) int(input()) N R -= L L R R = A[N - 1] A[N - 1] R pos = N N pos R = A[N - 1] A[N - 1] R M -= A[i] A[i] M L -= A[j] A[j] L pos = i i pos L = A[0] A[0] L R -= A[j] A[j] R X = [A[0]] [A[0]] X M = A[N-1] - M A[N-1] - M M
N = int(input())
A = list(map(int, input().split()))
A.sort()
M = A[0]
X = [A[0]]
pos = N
for i in range(N):
  if A[i] >= 0:
    pos = i
    break
if pos == 0:
  for i in range(1, N - 1):
    M -= A[i]
    X.append(M)
  S = M
  M = A[N-1] - M
  print(M)
  for i in range(N - 2):
    print(X[i], A[i+1])
  print(A[N - 1], S)
elif 1 <= pos <= N - 1:
  M = sum(abs(_) for _ in A)
  print(M)
  L = A[0]
  for j in range(pos, N - 1):
    print(L, A[j])
    L -= A[j]
  R = A[N - 1]
  print(R, L)
  R -= L
  for j in range(1, pos):
    print(R, A[j])
    R -= A[j]
elif pos == N:
  print(A[N-1] - sum(A[i] for i in range(N-1)))
  R = A[N - 1]
  for i in range(N-1):
    print(R, A[i])
    R -= A[i]