N = int(input())
l = list(map(int,input().split()))
l.sort()
sousa = []
next_m = l[0]
next_p = l[N-1]
for i in range(1,N-1):
    if l[i] > 0:
        sousa.append([next_m,l[i]])
        next_m -= l[i]
    else:
        sousa.append([next_p,l[i]])
        next_p -= l[i]
ans = next_p - next_m
print(ans)
sousa.append([next_p,next_m])
for i in range(N-1):
    print(str(sousa[i][0])+" "+str(sousa[i][1]))
 N = int(input()) N int(input()) int input() input l = list(map(int,input().split())) l list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split l.sort() l.sort l sort sousa = [] sousa [] next_m = l[0] next_m l[0] l 0 next_p = l[N-1] next_p l[N-1] l N-1 N 1 for i in range(1,N-1):
    if l[i] > 0:
        sousa.append([next_m,l[i]])
        next_m -= l[i]
    else:
        sousa.append([next_p,l[i]])
        next_p -= l[i] i range(1,N-1) range 1 N-1 N 1 if l[i] > 0:
        sousa.append([next_m,l[i]])
        next_m -= l[i]
    else:
        sousa.append([next_p,l[i]])
        next_p -= l[i] l[i] > 0 l[i] l i 0 sousa.append([next_m,l[i]]) sousa.append sousa append [next_m,l[i]] next_m l[i] l i next_m -= l[i] next_m l[i] l i sousa.append([next_p,l[i]]) sousa.append sousa append [next_p,l[i]] next_p l[i] l i next_p -= l[i] next_p l[i] l i ans = next_p - next_m ans next_p - next_m next_p next_m print(ans) print ans sousa.append([next_p,next_m]) sousa.append sousa append [next_p,next_m] next_p next_m for i in range(N-1):
    print(str(sousa[i][0])+" "+str(sousa[i][1])) i range(N-1) range N-1 N 1 print(str(sousa[i][0])+" "+str(sousa[i][1])) print str(sousa[i][0])+" "+str(sousa[i][1]) str(sousa[i][0])+" " str(sousa[i][0]) str sousa[i][0] [i] sousa i 0 " " str(sousa[i][1]) str sousa[i][1] [i] sousa i 1 l = list(map(int,input().split())) list(map(int,input().split())) l next_p = l[N-1] l[N-1] next_p next_p -= l[i] l[i] next_p next_m = l[0] l[0] next_m ans = next_p - next_m next_p - next_m ans N = int(input()) int(input()) N sousa = [] [] sousa next_m -= l[i] l[i] next_m
N = int(input())
l = list(map(int,input().split()))
l.sort()
sousa = []
next_m = l[0]
next_p = l[N-1]
for i in range(1,N-1):
    if l[i] > 0:
        sousa.append([next_m,l[i]])
        next_m -= l[i]
    else:
        sousa.append([next_p,l[i]])
        next_p -= l[i]
ans = next_p - next_m
print(ans)
sousa.append([next_p,next_m])
for i in range(N-1):
    print(str(sousa[i][0])+" "+str(sousa[i][1]))

