n=int(input())
A=list(map(int,input().split()))

if n==2:
    print(abs(A[0]-A[1]))
    print(*A)
    exit()
A.sort()
menos=[] ; plus=[]
for i in range(len(A)):
    if A[i]<0:
        menos.append(A[i])
    else:
        plus.append(A[i])
if menos==[]:
    print(sum(plus)-plus[0]*2)
    res=plus[0]
    for i in range(n-2):
        print(res, A[i+1])
        res=res-A[i+1]
    print(A[n-1], res);exit()
        
elif plus==[]:
    print(-sum(menos)+ menos[-1]*2)
    res=menos[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
    

print(sum(plus)-sum(menos))
m=len(menos); p=len(plus)
if p==1:
    res=plus[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
if m==1:
    res=menos[0]
    for i in range(n-2):
        print(res, plus[i])
        res=res-plus[i]
    print(plus[-1], res);exit()

Q= plus[1:]+ [menos[0]]
W= menos[1:]+[plus[0]] ;#print(Q,W)

res=W[-1]
for i in range(len(W)-1):
    print(res,W[i])
    res=res-W[i]
rec=Q[-1]
for i in range(len(Q)-1):
    print(rec, Q[i])
    rec=rec-Q[i]
print(res,rec) 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 if n==2:
    print(abs(A[0]-A[1]))
    print(*A)
    exit() n==2 n 2 print(abs(A[0]-A[1])) print abs(A[0]-A[1]) abs A[0]-A[1] A[0] A 0 A[1] A 1 print(*A) print *A A exit() exit A.sort() A.sort A sort menos=[] menos [] plus=[] plus [] for i in range(len(A)):
    if A[i]<0:
        menos.append(A[i])
    else:
        plus.append(A[i]) i range(len(A)) range len(A) len A if A[i]<0:
        menos.append(A[i])
    else:
        plus.append(A[i]) A[i]<0 A[i] A i 0 menos.append(A[i]) menos.append menos append A[i] A i plus.append(A[i]) plus.append plus append A[i] A i if menos==[]:
    print(sum(plus)-plus[0]*2)
    res=plus[0]
    for i in range(n-2):
        print(res, A[i+1])
        res=res-A[i+1]
    print(A[n-1], res);exit()
        
elif plus==[]:
    print(-sum(menos)+ menos[-1]*2)
    res=menos[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
     menos==[] menos [] print(sum(plus)-plus[0]*2) print sum(plus)-plus[0]*2 sum(plus) sum plus plus[0]*2 plus[0] plus 0 2 res=plus[0] res plus[0] plus 0 for i in range(n-2):
        print(res, A[i+1])
        res=res-A[i+1]
     i range(n-2) range n-2 n 2 print(res, A[i+1]) print res A[i+1] A i+1 i 1 res=res-A[i+1] res res-A[i+1] res A[i+1] A i+1 i 1 print(A[n-1], res) print A[n-1] A n-1 n 1 res exit() exit elif plus==[]:
    print(-sum(menos)+ menos[-1]*2)
    res=menos[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
     plus==[] plus [] print(-sum(menos)+ menos[-1]*2) print -sum(menos)+ menos[-1]*2 -sum(menos) sum(menos) sum menos menos[-1]*2 menos[-1] menos -1 2 res=menos[-1] res menos[-1] menos -1 for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
     i range(n-1) range n-1 n 1 print(res,menos[i]) print res menos[i] menos i res=res-menos[i] res res-menos[i] res menos[i] menos i exit() exit print(sum(plus)-sum(menos)) print sum(plus)-sum(menos) sum(plus) sum plus sum(menos) sum menos m=len(menos) m len(menos) len menos p=len(plus) p len(plus) len plus if p==1:
    res=plus[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit() p==1 p 1 res=plus[-1] res plus[-1] plus -1 for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
     i range(n-1) range n-1 n 1 print(res,menos[i]) print res menos[i] menos i res=res-menos[i] res res-menos[i] res menos[i] menos i exit() exit if m==1:
    res=menos[0]
    for i in range(n-2):
        print(res, plus[i])
        res=res-plus[i]
    print(plus[-1], res);exit() m==1 m 1 res=menos[0] res menos[0] menos 0 for i in range(n-2):
        print(res, plus[i])
        res=res-plus[i]
     i range(n-2) range n-2 n 2 print(res, plus[i]) print res plus[i] plus i res=res-plus[i] res res-plus[i] res plus[i] plus i print(plus[-1], res) print plus[-1] plus -1 res exit() exit Q= plus[1:]+ [menos[0]] Q plus[1:]+ [menos[0]] plus[1:] plus 1: 1 [menos[0]] menos[0] menos 0 W= menos[1:]+[plus[0]] W menos[1:]+[plus[0]] menos[1:] menos 1: 1 [plus[0]] plus[0] plus 0 res=W[-1] res W[-1] W -1 for i in range(len(W)-1):
    print(res,W[i])
    res=res-W[i] i range(len(W)-1) range len(W)-1 len(W) len W 1 print(res,W[i]) print res W[i] W i res=res-W[i] res res-W[i] res W[i] W i rec=Q[-1] rec Q[-1] Q -1 for i in range(len(Q)-1):
    print(rec, Q[i])
    rec=rec-Q[i] i range(len(Q)-1) range len(Q)-1 len(Q) len Q 1 print(rec, Q[i]) print rec Q[i] Q i rec=rec-Q[i] rec rec-Q[i] rec Q[i] Q i print(res,rec) print res rec res=res-W[i] res-W[i] res res=res-A[i+1] res-A[i+1] res menos=[] [] menos res=W[-1] W[-1] res res=res-menos[i] res-menos[i] res m=len(menos) len(menos) m Q= plus[1:]+ [menos[0]] plus[1:]+ [menos[0]] Q A=list(map(int,input().split())) list(map(int,input().split())) A plus=[] [] plus res=res-menos[i] res-menos[i] res rec=rec-Q[i] rec-Q[i] rec res=plus[0] plus[0] res p=len(plus) len(plus) p rec=Q[-1] Q[-1] rec res=res-plus[i] res-plus[i] res n=int(input()) int(input()) n res=menos[-1] menos[-1] res res=menos[0] menos[0] res W= menos[1:]+[plus[0]] menos[1:]+[plus[0]] W res=plus[-1] plus[-1] res
n=int(input())
A=list(map(int,input().split()))

if n==2:
    print(abs(A[0]-A[1]))
    print(*A)
    exit()
A.sort()
menos=[] ; plus=[]
for i in range(len(A)):
    if A[i]<0:
        menos.append(A[i])
    else:
        plus.append(A[i])
if menos==[]:
    print(sum(plus)-plus[0]*2)
    res=plus[0]
    for i in range(n-2):
        print(res, A[i+1])
        res=res-A[i+1]
    print(A[n-1], res);exit()
        
elif plus==[]:
    print(-sum(menos)+ menos[-1]*2)
    res=menos[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
    

print(sum(plus)-sum(menos))
m=len(menos); p=len(plus)
if p==1:
    res=plus[-1]
    for i in range(n-1):
        print(res,menos[i])
        res=res-menos[i]
    exit()
if m==1:
    res=menos[0]
    for i in range(n-2):
        print(res, plus[i])
        res=res-plus[i]
    print(plus[-1], res);exit()

Q= plus[1:]+ [menos[0]]
W= menos[1:]+[plus[0]] ;#print(Q,W)

res=W[-1]
for i in range(len(W)-1):
    print(res,W[i])
    res=res-W[i]
rec=Q[-1]
for i in range(len(Q)-1):
    print(rec, Q[i])
    rec=rec-Q[i]
print(res,rec)