import bisect

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

ans = []

A = sorted(A)

if N == 2 :
    ans.append([A[1],A[0]])
    calc = A[1] - A[0]

else :
    ind = bisect.bisect_left(A,0)

    X = A[:ind]
    Y = A[ind:]
    
    if len(X) == 0 :
        ans.append([Y[0],Y[1]])
        X.append(Y.pop(0)-Y.pop(0))
    
    elif len(Y) == 0 :
        ans.append([X[-1],X[-2]])
        Y.append(X.pop(-1)-X.pop(-1))
    
    while len(Y) != 1 :
        ans.append([X[-1],Y[0]])
        X[-1] -= Y.pop(0)
    
    while len(X) :
        ans.append([Y[0],X[-1]])
        Y[0] -= X.pop(-1)
    
    calc = Y.pop(0)

print(calc)
for a in ans :
    print(*a) import bisect bisect 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 ans = [] ans [] A = sorted(A) A sorted(A) sorted A if N == 2 :
    ans.append([A[1],A[0]])
    calc = A[1] - A[0]

else :
    ind = bisect.bisect_left(A,0)

    X = A[:ind]
    Y = A[ind:]
    
    if len(X) == 0 :
        ans.append([Y[0],Y[1]])
        X.append(Y.pop(0)-Y.pop(0))
    
    elif len(Y) == 0 :
        ans.append([X[-1],X[-2]])
        Y.append(X.pop(-1)-X.pop(-1))
    
    while len(Y) != 1 :
        ans.append([X[-1],Y[0]])
        X[-1] -= Y.pop(0)
    
    while len(X) :
        ans.append([Y[0],X[-1]])
        Y[0] -= X.pop(-1)
    
    calc = Y.pop(0) N == 2 N 2 ans.append([A[1],A[0]]) ans.append ans append [A[1],A[0]] A[1] A 1 A[0] A 0 calc = A[1] - A[0] calc A[1] - A[0] A[1] A 1 A[0] A 0 ind = bisect.bisect_left(A,0) ind bisect.bisect_left(A,0) bisect.bisect_left bisect bisect_left A 0 X = A[:ind] X A[:ind] A :ind ind Y = A[ind:] Y A[ind:] A ind: ind if len(X) == 0 :
        ans.append([Y[0],Y[1]])
        X.append(Y.pop(0)-Y.pop(0))
    
    elif len(Y) == 0 :
        ans.append([X[-1],X[-2]])
        Y.append(X.pop(-1)-X.pop(-1))
    
     len(X) == 0 len(X) len X 0 ans.append([Y[0],Y[1]]) ans.append ans append [Y[0],Y[1]] Y[0] Y 0 Y[1] Y 1 X.append(Y.pop(0)-Y.pop(0)) X.append X append Y.pop(0)-Y.pop(0) Y.pop(0) Y.pop Y pop 0 Y.pop(0) Y.pop Y pop 0 elif len(Y) == 0 :
        ans.append([X[-1],X[-2]])
        Y.append(X.pop(-1)-X.pop(-1))
    
     len(Y) == 0 len(Y) len Y 0 ans.append([X[-1],X[-2]]) ans.append ans append [X[-1],X[-2]] X[-1] X -1 X[-2] X -2 Y.append(X.pop(-1)-X.pop(-1)) Y.append Y append X.pop(-1)-X.pop(-1) X.pop(-1) X.pop X pop -1 X.pop(-1) X.pop X pop -1 while len(Y) != 1 :
        ans.append([X[-1],Y[0]])
        X[-1] -= Y.pop(0)
    
     len(Y) != 1 len(Y) len Y 1 ans.append([X[-1],Y[0]]) ans.append ans append [X[-1],Y[0]] X[-1] X -1 Y[0] Y 0 X[-1] -= Y.pop(0) X[-1] X -1 Y.pop(0) Y.pop Y pop 0 while len(X) :
        ans.append([Y[0],X[-1]])
        Y[0] -= X.pop(-1)
    
     len(X) len X ans.append([Y[0],X[-1]]) ans.append ans append [Y[0],X[-1]] Y[0] Y 0 X[-1] X -1 Y[0] -= X.pop(-1) Y[0] Y 0 X.pop(-1) X.pop X pop -1 calc = Y.pop(0) calc Y.pop(0) Y.pop Y pop 0 print(calc) print calc for a in ans :
    print(*a) a ans print(*a) print *a a N = int(input()) int(input()) N A = sorted(A) sorted(A) A calc = A[1] - A[0] A[1] - A[0] calc X = A[:ind] A[:ind] X ans = [] [] ans A = list(map(int,input().split())) list(map(int,input().split())) A ind = bisect.bisect_left(A,0) bisect.bisect_left(A,0) ind Y = A[ind:] A[ind:] Y calc = Y.pop(0) Y.pop(0) calc
import bisect

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

ans = []

A = sorted(A)

if N == 2 :
    ans.append([A[1],A[0]])
    calc = A[1] - A[0]

else :
    ind = bisect.bisect_left(A,0)

    X = A[:ind]
    Y = A[ind:]
    
    if len(X) == 0 :
        ans.append([Y[0],Y[1]])
        X.append(Y.pop(0)-Y.pop(0))
    
    elif len(Y) == 0 :
        ans.append([X[-1],X[-2]])
        Y.append(X.pop(-1)-X.pop(-1))
    
    while len(Y) != 1 :
        ans.append([X[-1],Y[0]])
        X[-1] -= Y.pop(0)
    
    while len(X) :
        ans.append([Y[0],X[-1]])
        Y[0] -= X.pop(-1)
    
    calc = Y.pop(0)

print(calc)
for a in ans :
    print(*a)
