N = int(input())						# 5
A = sorted(list( map(int, input().split()) ))	# 1 2 3 4 5 ...(ソート付き)

ANS=[]

a=A[0]
z=A[-1]

s=0
t=0

for i in A[1:-1]:
	if i>=0:
		ANS.append((a,i))
		a = a-i
	else:
		ANS.append((z,i))
		z = z-i


ANS.append((z,a))

print(z-a)
for a in ANS:
	print(*a)
 N = int(input()) N int(input()) int input() input A = sorted(list( map(int, input().split()) )) A sorted(list( map(int, input().split()) )) sorted list( map(int, input().split()) ) list map(int, input().split()) map int input().split() ().split () input split ANS=[] ANS [] a=A[0] a A[0] A 0 z=A[-1] z A[-1] A -1 s=0 s 0 t=0 t 0 for i in A[1:-1]:
	if i>=0:
		ANS.append((a,i))
		a = a-i
	else:
		ANS.append((z,i))
		z = z-i i A[1:-1] A 1:-1 1 -1 if i>=0:
		ANS.append((a,i))
		a = a-i
	else:
		ANS.append((z,i))
		z = z-i i>=0 i 0 ANS.append((a,i)) ANS.append ANS append (a,i) a i a = a-i a a-i a i ANS.append((z,i)) ANS.append ANS append (z,i) z i z = z-i z z-i z i ANS.append((z,a)) ANS.append ANS append (z,a) z a print(z-a) print z-a z a for a in ANS:
	print(*a) a ANS print(*a) print *a a s=0 0 s z=A[-1] A[-1] z ANS=[] [] ANS a = a-i a-i a t=0 0 t a=A[0] A[0] a N = int(input()) int(input()) N A = sorted(list( map(int, input().split()) )) sorted(list( map(int, input().split()) )) A z = z-i z-i z
N = int(input())						# 5
A = sorted(list( map(int, input().split()) ))	# 1 2 3 4 5 ...(ソート付き)

ANS=[]

a=A[0]
z=A[-1]

s=0
t=0

for i in A[1:-1]:
	if i>=0:
		ANS.append((a,i))
		a = a-i
	else:
		ANS.append((z,i))
		z = z-i


ANS.append((z,a))

print(z-a)
for a in ANS:
	print(*a)

