N=int(input())
A=list(map(int,input().split()))
A.sort()
B=[A[i] for i in reversed(range(N)) if A[i]<0]
C=[A[i] for i in range(N) if A[i]>=0]
s=0
if len(B)>0 and len(C)>0:
  s=sum(B)*-1
  s+=sum(C)
else:
  if len(B)>0:
    s=B[0]-(sum(B)-B[0])
  else:
    s=sum(C)-C[0]*2
print(s)
tmp=0
if len(B)==0:
  tmp=C[0]
  for i in range(2,len(C)):
    print(tmp,C[i])
    tmp-=C[i]
  print(C[1],tmp)
  
  
elif len(C)==0:
  tmp=B[0]
  for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i]
else:
  tmp=C[0]
  tmp2=B[0]
  for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i]
  for i in range(1,len(C)):
    print(tmp2,C[i])
    tmp2-=C[i]
  print(tmp,tmp2)
  tmp-=tmp2 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 A[i] for i in reversed(range(N)) if A[i]<0 for i in reversed(range(N)) if A[i]<0 i reversed(range(N)) reversed range(N) range N A[i]<0 A[i] A i 0 if A[i]<0 A[i] A i B=[A[i] for i in reversed(range(N)) if A[i]<0] B [A[i] for i in reversed(range(N)) if A[i]<0] A[i] for i in range(N) if A[i]>=0 for i in range(N) if A[i]>=0 i range(N) range N A[i]>=0 A[i] A i 0 if A[i]>=0 A[i] A i C=[A[i] for i in range(N) if A[i]>=0] C [A[i] for i in range(N) if A[i]>=0] s=0 s 0 if len(B)>0 and len(C)>0:
  s=sum(B)*-1
  s+=sum(C)
else:
  if len(B)>0:
    s=B[0]-(sum(B)-B[0])
  else:
    s=sum(C)-C[0]*2 len(B)>0 and len(C)>0 len(B)>0 len(B) len B 0 len(C)>0 len(C) len C 0 s=sum(B)*-1 s sum(B)*-1 sum(B) sum B -1 s+=sum(C) s sum(C) sum C if len(B)>0:
    s=B[0]-(sum(B)-B[0])
  else:
    s=sum(C)-C[0]*2 len(B)>0 len(B) len B 0 s=B[0]-(sum(B)-B[0]) s B[0]-(sum(B)-B[0]) B[0] B 0 sum(B)-B[0] sum(B) sum B B[0] B 0 s=sum(C)-C[0]*2 s sum(C)-C[0]*2 sum(C) sum C C[0]*2 C[0] C 0 2 print(s) print s tmp=0 tmp 0 if len(B)==0:
  tmp=C[0]
  for i in range(2,len(C)):
    print(tmp,C[i])
    tmp-=C[i]
  print(C[1],tmp)
  
  
elif len(C)==0:
  tmp=B[0]
  for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i]
else:
  tmp=C[0]
  tmp2=B[0]
  for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i]
  for i in range(1,len(C)):
    print(tmp2,C[i])
    tmp2-=C[i]
  print(tmp,tmp2)
  tmp-=tmp2 len(B)==0 len(B) len B 0 tmp=C[0] tmp C[0] C 0 for i in range(2,len(C)):
    print(tmp,C[i])
    tmp-=C[i]
   i range(2,len(C)) range 2 len(C) len C print(tmp,C[i]) print tmp C[i] C i tmp-=C[i] tmp C[i] C i print(C[1],tmp) print C[1] C 1 tmp elif len(C)==0:
  tmp=B[0]
  for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i] len(C)==0 len(C) len C 0 tmp=B[0] tmp B[0] B 0 for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i] i range(1,len(B)) range 1 len(B) len B print(tmp,B[i]) print tmp B[i] B i tmp-=B[i] tmp B[i] B i tmp=C[0] tmp C[0] C 0 tmp2=B[0] tmp2 B[0] B 0 for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i]
   i range(1,len(B)) range 1 len(B) len B print(tmp,B[i]) print tmp B[i] B i tmp-=B[i] tmp B[i] B i for i in range(1,len(C)):
    print(tmp2,C[i])
    tmp2-=C[i]
   i range(1,len(C)) range 1 len(C) len C print(tmp2,C[i]) print tmp2 C[i] C i tmp2-=C[i] tmp2 C[i] C i print(tmp,tmp2) print tmp tmp2 tmp-=tmp2 tmp tmp2 C=[A[i] for i in range(N) if A[i]>=0] [A[i] for i in range(N) if A[i]>=0] C s=B[0]-(sum(B)-B[0]) B[0]-(sum(B)-B[0]) s tmp-=tmp2 tmp2 tmp A=list(map(int,input().split())) list(map(int,input().split())) A s=0 0 s tmp2=B[0] B[0] tmp2 tmp=C[0] C[0] tmp tmp=C[0] C[0] tmp s+=sum(C) sum(C) s tmp2-=C[i] C[i] tmp2 s=sum(C)-C[0]*2 sum(C)-C[0]*2 s tmp=0 0 tmp tmp=B[0] B[0] tmp tmp-=B[i] B[i] tmp B=[A[i] for i in reversed(range(N)) if A[i]<0] [A[i] for i in reversed(range(N)) if A[i]<0] B tmp-=C[i] C[i] tmp s=sum(B)*-1 sum(B)*-1 s tmp-=B[i] B[i] tmp N=int(input()) int(input()) N
N=int(input())
A=list(map(int,input().split()))
A.sort()
B=[A[i] for i in reversed(range(N)) if A[i]<0]
C=[A[i] for i in range(N) if A[i]>=0]
s=0
if len(B)>0 and len(C)>0:
  s=sum(B)*-1
  s+=sum(C)
else:
  if len(B)>0:
    s=B[0]-(sum(B)-B[0])
  else:
    s=sum(C)-C[0]*2
print(s)
tmp=0
if len(B)==0:
  tmp=C[0]
  for i in range(2,len(C)):
    print(tmp,C[i])
    tmp-=C[i]
  print(C[1],tmp)
  
  
elif len(C)==0:
  tmp=B[0]
  for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i]
else:
  tmp=C[0]
  tmp2=B[0]
  for i in range(1,len(B)):
    print(tmp,B[i])
    tmp-=B[i]
  for i in range(1,len(C)):
    print(tmp2,C[i])
    tmp2-=C[i]
  print(tmp,tmp2)
  tmp-=tmp2
