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