N=int(input())
A=list(map(int,input().split()))
A.sort()
flag=[0]*N
ans=[]
for i in range(1,N-1):
    if A[i]<0:
        ans.append([A[-1],A[i]])
        A[-1]-=A[i]
    else:
        ans.append([A[0],A[i]])
        A[0]-=A[i]
ans.append([A[-1],A[0]])
M=A[-1]-A[0]
print(M)
for u in ans:
    print(*u) 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 flag=[0]*N flag [0]*N [0] 0 N ans=[] ans [] for i in range(1,N-1):
    if A[i]<0:
        ans.append([A[-1],A[i]])
        A[-1]-=A[i]
    else:
        ans.append([A[0],A[i]])
        A[0]-=A[i] i range(1,N-1) range 1 N-1 N 1 if A[i]<0:
        ans.append([A[-1],A[i]])
        A[-1]-=A[i]
    else:
        ans.append([A[0],A[i]])
        A[0]-=A[i] A[i]<0 A[i] A i 0 ans.append([A[-1],A[i]]) ans.append ans 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 ans.append([A[0],A[i]]) ans.append ans 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 ans.append([A[-1],A[0]]) ans.append ans append [A[-1],A[0]] A[-1] A -1 A[0] A 0 M=A[-1]-A[0] M A[-1]-A[0] A[-1] A -1 A[0] A 0 print(M) print M for u in ans:
    print(*u) u ans print(*u) print *u u N=int(input()) int(input()) N A=list(map(int,input().split())) list(map(int,input().split())) A flag=[0]*N [0]*N flag M=A[-1]-A[0] A[-1]-A[0] M ans=[] [] ans
N=int(input())
A=list(map(int,input().split()))
A.sort()
flag=[0]*N
ans=[]
for i in range(1,N-1):
    if A[i]<0:
        ans.append([A[-1],A[i]])
        A[-1]-=A[i]
    else:
        ans.append([A[0],A[i]])
        A[0]-=A[i]
ans.append([A[-1],A[0]])
M=A[-1]-A[0]
print(M)
for u in ans:
    print(*u)