n=int(input())
L=list(map(int,input().split()))
L.sort()
ans=[]
for i in range(1,n-1):
  if L[i]>0:
    ans.append((L[0],L[i]))
    L[0]-=L[i]
for i in range(n):
  if L[i]>0 or len(ans) == n-1:
    break
  else:
    ans.append((L[n-1],L[i]))
    L[n-1]-=L[i]
print(L[n-1])
for a in ans:
  x,y=a
  print(x,y) 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 ans=[] ans [] for i in range(1,n-1):
  if L[i]>0:
    ans.append((L[0],L[i]))
    L[0]-=L[i] i range(1,n-1) range 1 n-1 n 1 if L[i]>0:
    ans.append((L[0],L[i]))
    L[0]-=L[i] L[i]>0 L[i] L i 0 ans.append((L[0],L[i])) ans.append ans append (L[0],L[i]) L[0] L 0 L[i] L i L[0]-=L[i] L[0] L 0 L[i] L i for i in range(n):
  if L[i]>0 or len(ans) == n-1:
    break
  else:
    ans.append((L[n-1],L[i]))
    L[n-1]-=L[i] i range(n) range n if L[i]>0 or len(ans) == n-1:
    break
  else:
    ans.append((L[n-1],L[i]))
    L[n-1]-=L[i] L[i]>0 or len(ans) == n-1 L[i]>0 L[i] L i 0 len(ans) == n-1 len(ans) len ans n-1 n 1 break ans.append((L[n-1],L[i])) ans.append ans append (L[n-1],L[i]) L[n-1] L n-1 n 1 L[i] L i L[n-1]-=L[i] L[n-1] L n-1 n 1 L[i] L i print(L[n-1]) print L[n-1] L n-1 n 1 for a in ans:
  x,y=a
  print(x,y) a ans x,y=a x a y print(x,y) print x y x,y=a a x n=int(input()) int(input()) n y=a a y L=list(map(int,input().split())) list(map(int,input().split())) L ans=[] [] ans
n=int(input())
L=list(map(int,input().split()))
L.sort()
ans=[]
for i in range(1,n-1):
  if L[i]>0:
    ans.append((L[0],L[i]))
    L[0]-=L[i]
for i in range(n):
  if L[i]>0 or len(ans) == n-1:
    break
  else:
    ans.append((L[n-1],L[i]))
    L[n-1]-=L[i]
print(L[n-1])
for a in ans:
  x,y=a
  print(x,y)
