N = int(input())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
Y, X = [A[0]], [A[-1]]
for i in range(1, N-1):
    if A[i] >= 0:
        Y.append(A[i])
    else:
        X.append(A[i])
res = []

for i in range(len(Y)-1,0,-1) :
    res.append([X[-1],Y[i]])
    X[-1] -= Y[i]

for i in range(len(X)-1,-1,-1) :
    res.append([Y[0],X[i]])
    Y[0] -= X[i]

print(Y[0])
for r in res :
    print(*r) 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 = sorted(A,reverse=True) A sorted(A,reverse=True) sorted A reverse=True reverse True Y, X = [A[0]], [A[-1]] Y [A[0]] A[0] A 0 X [A[-1]] A[-1] A -1 for i in range(1, N-1):
    if A[i] >= 0:
        Y.append(A[i])
    else:
        X.append(A[i]) i range(1, N-1) range 1 N-1 N 1 if A[i] >= 0:
        Y.append(A[i])
    else:
        X.append(A[i]) A[i] >= 0 A[i] A i 0 Y.append(A[i]) Y.append Y append A[i] A i X.append(A[i]) X.append X append A[i] A i res = [] res [] for i in range(len(Y)-1,0,-1) :
    res.append([X[-1],Y[i]])
    X[-1] -= Y[i] i range(len(Y)-1,0,-1) range len(Y)-1 len(Y) len Y 1 0 -1 res.append([X[-1],Y[i]]) res.append res append [X[-1],Y[i]] X[-1] X -1 Y[i] Y i X[-1] -= Y[i] X[-1] X -1 Y[i] Y i for i in range(len(X)-1,-1,-1) :
    res.append([Y[0],X[i]])
    Y[0] -= X[i] i range(len(X)-1,-1,-1) range len(X)-1 len(X) len X 1 -1 -1 res.append([Y[0],X[i]]) res.append res append [Y[0],X[i]] Y[0] Y 0 X[i] X i Y[0] -= X[i] Y[0] Y 0 X[i] X i print(Y[0]) print Y[0] Y 0 for r in res :
    print(*r) r res print(*r) print *r r res = [] [] res X = [A[0]], [A[-1]] [A[-1]] X A = sorted(A,reverse=True) sorted(A,reverse=True) A A = list(map(int,input().split())) list(map(int,input().split())) A Y, X = [A[0]], [A[-1]] [A[0]] Y N = int(input()) int(input()) N
N = int(input())
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
Y, X = [A[0]], [A[-1]]
for i in range(1, N-1):
    if A[i] >= 0:
        Y.append(A[i])
    else:
        X.append(A[i])
res = []

for i in range(len(Y)-1,0,-1) :
    res.append([X[-1],Y[i]])
    X[-1] -= Y[i]

for i in range(len(X)-1,-1,-1) :
    res.append([Y[0],X[i]])
    Y[0] -= X[i]

print(Y[0])
for r in res :
    print(*r)
