import bisect

N = int(input())
A = list(map(int,input().split()))
A.sort()

i0 = bisect.bisect_left(A,0)
if i0 >= N-1:
  print(-sum(A[:N-1])+A[N-1])
  a = A[N-1]
  for i in range(N-1):
    print(a,A[i])
    a = a-A[i]
elif i0 <= 1:
  print(-A[0]+sum(A[1:]))
  a = A[0]
  for i in range(1,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
else:
  print(-sum(A[:i0])+sum(A[i0:]))
  a = A[i0-1]
  for i in range(i0,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
  a = A[N-1]-a
  for i in range(i0-1):
    print(a,A[i])
    a = a-A[i] import bisect bisect 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 i0 = bisect.bisect_left(A,0) i0 bisect.bisect_left(A,0) bisect.bisect_left bisect bisect_left A 0 if i0 >= N-1:
  print(-sum(A[:N-1])+A[N-1])
  a = A[N-1]
  for i in range(N-1):
    print(a,A[i])
    a = a-A[i]
elif i0 <= 1:
  print(-A[0]+sum(A[1:]))
  a = A[0]
  for i in range(1,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
else:
  print(-sum(A[:i0])+sum(A[i0:]))
  a = A[i0-1]
  for i in range(i0,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
  a = A[N-1]-a
  for i in range(i0-1):
    print(a,A[i])
    a = a-A[i] i0 >= N-1 i0 N-1 N 1 print(-sum(A[:N-1])+A[N-1]) print -sum(A[:N-1])+A[N-1] -sum(A[:N-1]) sum(A[:N-1]) sum A[:N-1] A :N-1 N-1 N 1 A[N-1] A N-1 N 1 a = A[N-1] a A[N-1] A N-1 N 1 for i in range(N-1):
    print(a,A[i])
    a = a-A[i] i range(N-1) range N-1 N 1 print(a,A[i]) print a A[i] A i a = a-A[i] a a-A[i] a A[i] A i elif i0 <= 1:
  print(-A[0]+sum(A[1:]))
  a = A[0]
  for i in range(1,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a) i0 <= 1 i0 1 print(-A[0]+sum(A[1:])) print -A[0]+sum(A[1:]) -A[0] A[0] A 0 sum(A[1:]) sum A[1:] A 1: 1 a = A[0] a A[0] A 0 for i in range(1,N-1):
    print(a,A[i])
    a = a-A[i]
   i range(1,N-1) range 1 N-1 N 1 print(a,A[i]) print a A[i] A i a = a-A[i] a a-A[i] a A[i] A i print(A[N-1],a) print A[N-1] A N-1 N 1 a print(-sum(A[:i0])+sum(A[i0:])) print -sum(A[:i0])+sum(A[i0:]) -sum(A[:i0]) sum(A[:i0]) sum A[:i0] A :i0 i0 sum(A[i0:]) sum A[i0:] A i0: i0 a = A[i0-1] a A[i0-1] A i0-1 i0 1 for i in range(i0,N-1):
    print(a,A[i])
    a = a-A[i]
   i range(i0,N-1) range i0 N-1 N 1 print(a,A[i]) print a A[i] A i a = a-A[i] a a-A[i] a A[i] A i print(A[N-1],a) print A[N-1] A N-1 N 1 a a = A[N-1]-a a A[N-1]-a A[N-1] A N-1 N 1 a for i in range(i0-1):
    print(a,A[i])
    a = a-A[i] i range(i0-1) range i0-1 i0 1 print(a,A[i]) print a A[i] A i a = a-A[i] a a-A[i] a A[i] A i a = A[N-1]-a A[N-1]-a a i0 = bisect.bisect_left(A,0) bisect.bisect_left(A,0) i0 a = A[i0-1] A[i0-1] a a = A[0] A[0] a a = a-A[i] a-A[i] a A = list(map(int,input().split())) list(map(int,input().split())) A a = a-A[i] a-A[i] a a = a-A[i] a-A[i] a a = A[N-1] A[N-1] a a = a-A[i] a-A[i] a N = int(input()) int(input()) N
import bisect

N = int(input())
A = list(map(int,input().split()))
A.sort()

i0 = bisect.bisect_left(A,0)
if i0 >= N-1:
  print(-sum(A[:N-1])+A[N-1])
  a = A[N-1]
  for i in range(N-1):
    print(a,A[i])
    a = a-A[i]
elif i0 <= 1:
  print(-A[0]+sum(A[1:]))
  a = A[0]
  for i in range(1,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
else:
  print(-sum(A[:i0])+sum(A[i0:]))
  a = A[i0-1]
  for i in range(i0,N-1):
    print(a,A[i])
    a = a-A[i]
  print(A[N-1],a)
  a = A[N-1]-a
  for i in range(i0-1):
    print(a,A[i])
    a = a-A[i]
