N=int(input())
listA=list(map(int,input().split()))
listB=[abs(i) for i in listA]
MAX=max(listA)
MIN=min(listA)
ans=sum(listB)
if MAX<=0:
  print(ans+MAX*2)
elif MIN<=0:
  print(ans)   
else:
  print(ans-MIN*2)
listC=sorted(listA)  
for i in range(len(listA)-2):
  if listC[i+1]>=0:
    print(MIN,listC[i+1])
    MIN=MIN-listC[i+1]
  else:
    print(MAX,listC[i+1])
    MAX=MAX-listC[i+1]
print(MAX,MIN) N=int(input()) N int(input()) int input() input listA=list(map(int,input().split())) listA list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split abs(i) for i in listA for i in listA i listA for i in listA abs(i) abs i listB=[abs(i) for i in listA] listB [abs(i) for i in listA] MAX=max(listA) MAX max(listA) max listA MIN=min(listA) MIN min(listA) min listA ans=sum(listB) ans sum(listB) sum listB if MAX<=0:
  print(ans+MAX*2)
elif MIN<=0:
  print(ans)   
else:
  print(ans-MIN*2) MAX<=0 MAX 0 print(ans+MAX*2) print ans+MAX*2 ans MAX*2 MAX 2 elif MIN<=0:
  print(ans)    MIN<=0 MIN 0 print(ans) print ans print(ans-MIN*2) print ans-MIN*2 ans MIN*2 MIN 2 listC=sorted(listA) listC sorted(listA) sorted listA for i in range(len(listA)-2):
  if listC[i+1]>=0:
    print(MIN,listC[i+1])
    MIN=MIN-listC[i+1]
  else:
    print(MAX,listC[i+1])
    MAX=MAX-listC[i+1] i range(len(listA)-2) range len(listA)-2 len(listA) len listA 2 if listC[i+1]>=0:
    print(MIN,listC[i+1])
    MIN=MIN-listC[i+1]
  else:
    print(MAX,listC[i+1])
    MAX=MAX-listC[i+1] listC[i+1]>=0 listC[i+1] listC i+1 i 1 0 print(MIN,listC[i+1]) print MIN listC[i+1] listC i+1 i 1 MIN=MIN-listC[i+1] MIN MIN-listC[i+1] MIN listC[i+1] listC i+1 i 1 print(MAX,listC[i+1]) print MAX listC[i+1] listC i+1 i 1 MAX=MAX-listC[i+1] MAX MAX-listC[i+1] MAX listC[i+1] listC i+1 i 1 print(MAX,MIN) print MAX MIN MAX=MAX-listC[i+1] MAX-listC[i+1] MAX listB=[abs(i) for i in listA] [abs(i) for i in listA] listB listA=list(map(int,input().split())) list(map(int,input().split())) listA listC=sorted(listA) sorted(listA) listC N=int(input()) int(input()) N MAX=max(listA) max(listA) MAX ans=sum(listB) sum(listB) ans MIN=min(listA) min(listA) MIN MIN=MIN-listC[i+1] MIN-listC[i+1] MIN
N=int(input())
listA=list(map(int,input().split()))
listB=[abs(i) for i in listA]
MAX=max(listA)
MIN=min(listA)
ans=sum(listB)
if MAX<=0:
  print(ans+MAX*2)
elif MIN<=0:
  print(ans)   
else:
  print(ans-MIN*2)
listC=sorted(listA)  
for i in range(len(listA)-2):
  if listC[i+1]>=0:
    print(MIN,listC[i+1])
    MIN=MIN-listC[i+1]
  else:
    print(MAX,listC[i+1])
    MAX=MAX-listC[i+1]
print(MAX,MIN)