N=int(input())
A=list(map(int,input().split()))
A.sort()
P=0
Q=[]
if A[0]<=0 and A[-1]>=0:
  B,C=[],[]
  for i in range(N):
    if A[i]==0:
      if len(B)==0:
        B.append(0)
      else:
        C.append(0)
    else:
      if A[i]<0:
        B.append(A[i])
      else:
        C.append(A[i])
  for i in range(len(C)-1):
    Q.append([B[0],C[-1]])
    B[0]-=C[-1]
    del C[-1]
  for i in range(len(B)):
    Q.append([C[0],B[-1]])
    C[0]-=B[-1]
    del B[-1]
  P=C[0]
else:
  if A[0]>0:
    for i in range(N-2,0,-1):
      Q.append([A[0],A[i]])
      A[0]-=A[i]
    Q.append([A[-1],A[0]])
    P=A[-1]-A[0]
  else:
    for i in range(N-1):
      Q.append([A[-1],A[i]])
      A[-1]-=A[i]
    P=A[-1]
print(P)
for i in range(N-1):
  print(*Q[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 P=0 P 0 Q=[] Q [] if A[0]<=0 and A[-1]>=0:
  B,C=[],[]
  for i in range(N):
    if A[i]==0:
      if len(B)==0:
        B.append(0)
      else:
        C.append(0)
    else:
      if A[i]<0:
        B.append(A[i])
      else:
        C.append(A[i])
  for i in range(len(C)-1):
    Q.append([B[0],C[-1]])
    B[0]-=C[-1]
    del C[-1]
  for i in range(len(B)):
    Q.append([C[0],B[-1]])
    C[0]-=B[-1]
    del B[-1]
  P=C[0]
else:
  if A[0]>0:
    for i in range(N-2,0,-1):
      Q.append([A[0],A[i]])
      A[0]-=A[i]
    Q.append([A[-1],A[0]])
    P=A[-1]-A[0]
  else:
    for i in range(N-1):
      Q.append([A[-1],A[i]])
      A[-1]-=A[i]
    P=A[-1] A[0]<=0 and A[-1]>=0 A[0]<=0 A[0] A 0 0 A[-1]>=0 A[-1] A -1 0 B,C=[],[] B [] C [] for i in range(N):
    if A[i]==0:
      if len(B)==0:
        B.append(0)
      else:
        C.append(0)
    else:
      if A[i]<0:
        B.append(A[i])
      else:
        C.append(A[i])
   i range(N) range N if A[i]==0:
      if len(B)==0:
        B.append(0)
      else:
        C.append(0)
    else:
      if A[i]<0:
        B.append(A[i])
      else:
        C.append(A[i])
   A[i]==0 A[i] A i 0 if len(B)==0:
        B.append(0)
      else:
        C.append(0)
     len(B)==0 len(B) len B 0 B.append(0) B.append B append 0 C.append(0) C.append C append 0 if A[i]<0:
        B.append(A[i])
      else:
        C.append(A[i])
   A[i]<0 A[i] A i 0 B.append(A[i]) B.append B append A[i] A i C.append(A[i]) C.append C append A[i] A i for i in range(len(C)-1):
    Q.append([B[0],C[-1]])
    B[0]-=C[-1]
    del C[-1]
   i range(len(C)-1) range len(C)-1 len(C) len C 1 Q.append([B[0],C[-1]]) Q.append Q append [B[0],C[-1]] B[0] B 0 C[-1] C -1 B[0]-=C[-1] B[0] B 0 C[-1] C -1 del C[-1] C[-1] C -1 for i in range(len(B)):
    Q.append([C[0],B[-1]])
    C[0]-=B[-1]
    del B[-1]
   i range(len(B)) range len(B) len B Q.append([C[0],B[-1]]) Q.append Q append [C[0],B[-1]] C[0] C 0 B[-1] B -1 C[0]-=B[-1] C[0] C 0 B[-1] B -1 del B[-1] B[-1] B -1 P=C[0] P C[0] C 0 if A[0]>0:
    for i in range(N-2,0,-1):
      Q.append([A[0],A[i]])
      A[0]-=A[i]
    Q.append([A[-1],A[0]])
    P=A[-1]-A[0]
  else:
    for i in range(N-1):
      Q.append([A[-1],A[i]])
      A[-1]-=A[i]
    P=A[-1] A[0]>0 A[0] A 0 0 for i in range(N-2,0,-1):
      Q.append([A[0],A[i]])
      A[0]-=A[i]
     i range(N-2,0,-1) range N-2 N 2 0 -1 Q.append([A[0],A[i]]) Q.append Q 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 Q.append([A[-1],A[0]]) Q.append Q append [A[-1],A[0]] A[-1] A -1 A[0] A 0 P=A[-1]-A[0] P A[-1]-A[0] A[-1] A -1 A[0] A 0 for i in range(N-1):
      Q.append([A[-1],A[i]])
      A[-1]-=A[i]
     i range(N-1) range N-1 N 1 Q.append([A[-1],A[i]]) Q.append Q append [A[-1],A[i]] A[-1] A -1 A[i] A i A[-1]-=A[i] A[-1] A -1 A[i] A i P=A[-1] P A[-1] A -1 print(P) print P for i in range(N-1):
  print(*Q[i]) i range(N-1) range N-1 N 1 print(*Q[i]) print *Q[i] Q[i] Q i C=[],[] [] C P=A[-1]-A[0] A[-1]-A[0] P B,C=[],[] [] B Q=[] [] Q P=A[-1] A[-1] P P=C[0] C[0] P N=int(input()) int(input()) N A=list(map(int,input().split())) list(map(int,input().split())) A P=0 0 P
N=int(input())
A=list(map(int,input().split()))
A.sort()
P=0
Q=[]
if A[0]<=0 and A[-1]>=0:
  B,C=[],[]
  for i in range(N):
    if A[i]==0:
      if len(B)==0:
        B.append(0)
      else:
        C.append(0)
    else:
      if A[i]<0:
        B.append(A[i])
      else:
        C.append(A[i])
  for i in range(len(C)-1):
    Q.append([B[0],C[-1]])
    B[0]-=C[-1]
    del C[-1]
  for i in range(len(B)):
    Q.append([C[0],B[-1]])
    C[0]-=B[-1]
    del B[-1]
  P=C[0]
else:
  if A[0]>0:
    for i in range(N-2,0,-1):
      Q.append([A[0],A[i]])
      A[0]-=A[i]
    Q.append([A[-1],A[0]])
    P=A[-1]-A[0]
  else:
    for i in range(N-1):
      Q.append([A[-1],A[i]])
      A[-1]-=A[i]
    P=A[-1]
print(P)
for i in range(N-1):
  print(*Q[i])