n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
anslist = []

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

for i in range(1,n-1):
  if a[i] < 0:
    anslist.append([a[-1], a[i]])
    a[-1] -= a[i]
  else:
    anslist.append([a[0], a[i]])
    a[0] -= a[i]
anslist.append([a[-1], a[0]])
ans = a[-1]-a[0]
print(ans)
for i in range(len(anslist)):
  print(anslist[i][0], anslist[i][1])
    
  
      
