n=int(input())
l=list(map(int,input().split()))
l.sort()
if l[0]>=0 :
  print(sum(l)-2*l[0])
  for i in range(1,n-1):
    print(l[0],l[i])
    l[0]-=l[i]
  print(l[-1],l[0])
elif l[-1]<0:
  print(abs(sum(l)-2*l[-1]))
  for i in range(n-1):
    print(l[-1],l[i])
    l[-1]-=l[i]
else:
  cnt=0
  i=0
  while l[i]<0:
    cnt+=1
    if l[i+1]>=0:
      break
    i+=1
  ans=0
  for j in range(n):
    ans+=abs(l[j])
  print(ans)
  for j in range(n-2-i):
    print(l[0],l[i+j+1])
    l[0]-=l[i+j+1]
  for j in range(i+1):
    print(l[-1],l[j])
    l[-1]-=l[j]
     n=int(input()) n int(input()) int input() input l=list(map(int,input().split())) l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l.sort() l.sort l sort if l[0]>=0 :
  print(sum(l)-2*l[0])
  for i in range(1,n-1):
    print(l[0],l[i])
    l[0]-=l[i]
  print(l[-1],l[0])
elif l[-1]<0:
  print(abs(sum(l)-2*l[-1]))
  for i in range(n-1):
    print(l[-1],l[i])
    l[-1]-=l[i]
else:
  cnt=0
  i=0
  while l[i]<0:
    cnt+=1
    if l[i+1]>=0:
      break
    i+=1
  ans=0
  for j in range(n):
    ans+=abs(l[j])
  print(ans)
  for j in range(n-2-i):
    print(l[0],l[i+j+1])
    l[0]-=l[i+j+1]
  for j in range(i+1):
    print(l[-1],l[j])
    l[-1]-=l[j]
     l[0]>=0 l[0] l 0 0 print(sum(l)-2*l[0]) print sum(l)-2*l[0] sum(l) sum l 2*l[0] 2 l[0] l 0 for i in range(1,n-1):
    print(l[0],l[i])
    l[0]-=l[i]
   i range(1,n-1) range 1 n-1 n 1 print(l[0],l[i]) print l[0] l 0 l[i] l i l[0]-=l[i] l[0] l 0 l[i] l i print(l[-1],l[0]) print l[-1] l -1 l[0] l 0 elif l[-1]<0:
  print(abs(sum(l)-2*l[-1]))
  for i in range(n-1):
    print(l[-1],l[i])
    l[-1]-=l[i] l[-1]<0 l[-1] l -1 0 print(abs(sum(l)-2*l[-1])) print abs(sum(l)-2*l[-1]) abs sum(l)-2*l[-1] sum(l) sum l 2*l[-1] 2 l[-1] l -1 for i in range(n-1):
    print(l[-1],l[i])
    l[-1]-=l[i] i range(n-1) range n-1 n 1 print(l[-1],l[i]) print l[-1] l -1 l[i] l i l[-1]-=l[i] l[-1] l -1 l[i] l i cnt=0 cnt 0 i=0 i 0 while l[i]<0:
    cnt+=1
    if l[i+1]>=0:
      break
    i+=1
   l[i]<0 l[i] l i 0 cnt+=1 cnt 1 if l[i+1]>=0:
      break
     l[i+1]>=0 l[i+1] l i+1 i 1 0 break i+=1 i 1 ans=0 ans 0 for j in range(n):
    ans+=abs(l[j])
   j range(n) range n ans+=abs(l[j]) ans abs(l[j]) abs l[j] l j print(ans) print ans for j in range(n-2-i):
    print(l[0],l[i+j+1])
    l[0]-=l[i+j+1]
   j range(n-2-i) range n-2-i n-2 n 2 i print(l[0],l[i+j+1]) print l[0] l 0 l[i+j+1] l i+j+1 i+j i j 1 l[0]-=l[i+j+1] l[0] l 0 l[i+j+1] l i+j+1 i+j i j 1 for j in range(i+1):
    print(l[-1],l[j])
    l[-1]-=l[j]
     j range(i+1) range i+1 i 1 print(l[-1],l[j]) print l[-1] l -1 l[j] l j l[-1]-=l[j] l[-1] l -1 l[j] l j cnt=0 0 cnt cnt+=1 1 cnt l=list(map(int,input().split())) list(map(int,input().split())) l ans=0 0 ans i=0 0 i n=int(input()) int(input()) n i+=1 1 i ans+=abs(l[j]) abs(l[j]) ans
n=int(input())
l=list(map(int,input().split()))
l.sort()
if l[0]>=0 :
  print(sum(l)-2*l[0])
  for i in range(1,n-1):
    print(l[0],l[i])
    l[0]-=l[i]
  print(l[-1],l[0])
elif l[-1]<0:
  print(abs(sum(l)-2*l[-1]))
  for i in range(n-1):
    print(l[-1],l[i])
    l[-1]-=l[i]
else:
  cnt=0
  i=0
  while l[i]<0:
    cnt+=1
    if l[i+1]>=0:
      break
    i+=1
  ans=0
  for j in range(n):
    ans+=abs(l[j])
  print(ans)
  for j in range(n-2-i):
    print(l[0],l[i+j+1])
    l[0]-=l[i+j+1]
  for j in range(i+1):
    print(l[-1],l[j])
    l[-1]-=l[j]
    
