import bisect
N = int(input())
A = sorted(list(map(int, input().split())))
if N == 2:
    x, y = A[1], A[0]
    print(x-y)
    print(x, y)
    exit()
idx = bisect.bisect_left(A, 0)
if idx:
    if idx < N:
        Q = A[:idx]
        P = A[idx:]
    else:
        Q = A[:-1]
        P = [A[-1]]
else:
    Q = [A[0]]
    P = A[1:]


XY = []
LP = len(P)
for i in range(LP-1):
    XY.append((Q[0], P[i]))
    Q[0] -= P[i]
LQ = len(Q)
for i in range(LQ):
    XY.append((P[-1], Q[i]))
    P[-1] = P[-1] - Q[i]
ans = P[-1]
print(ans)
for x, y in XY:
    print(x, y)


 import bisect bisect N = int(input()) N int(input()) int input() input A = sorted(list(map(int, input().split()))) A sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split if N == 2:
    x, y = A[1], A[0]
    print(x-y)
    print(x, y)
    exit() N == 2 N 2 x, y = A[1], A[0] x A[1] A 1 y A[0] A 0 print(x-y) print x-y x y print(x, y) print x y exit() exit idx = bisect.bisect_left(A, 0) idx bisect.bisect_left(A, 0) bisect.bisect_left bisect bisect_left A 0 if idx:
    if idx < N:
        Q = A[:idx]
        P = A[idx:]
    else:
        Q = A[:-1]
        P = [A[-1]]
else:
    Q = [A[0]]
    P = A[1:] idx if idx < N:
        Q = A[:idx]
        P = A[idx:]
    else:
        Q = A[:-1]
        P = [A[-1]] idx < N idx N Q = A[:idx] Q A[:idx] A :idx idx P = A[idx:] P A[idx:] A idx: idx Q = A[:-1] Q A[:-1] A :-1 -1 P = [A[-1]] P [A[-1]] A[-1] A -1 Q = [A[0]] Q [A[0]] A[0] A 0 P = A[1:] P A[1:] A 1: 1 XY = [] XY [] LP = len(P) LP len(P) len P for i in range(LP-1):
    XY.append((Q[0], P[i]))
    Q[0] -= P[i] i range(LP-1) range LP-1 LP 1 XY.append((Q[0], P[i])) XY.append XY append (Q[0], P[i]) Q[0] Q 0 P[i] P i Q[0] -= P[i] Q[0] Q 0 P[i] P i LQ = len(Q) LQ len(Q) len Q for i in range(LQ):
    XY.append((P[-1], Q[i]))
    P[-1] = P[-1] - Q[i] i range(LQ) range LQ XY.append((P[-1], Q[i])) XY.append XY append (P[-1], Q[i]) P[-1] P -1 Q[i] Q i P[-1] = P[-1] - Q[i] P[-1] P -1 P[-1] - Q[i] P[-1] P -1 Q[i] Q i ans = P[-1] ans P[-1] P -1 print(ans) print ans for x, y in XY:
    print(x, y) x y XY print(x, y) print x y P = [A[-1]] [A[-1]] P y = A[1], A[0] A[0] y LQ = len(Q) len(Q) LQ LP = len(P) len(P) LP A = sorted(list(map(int, input().split()))) sorted(list(map(int, input().split()))) A Q = A[:idx] A[:idx] Q P = A[idx:] A[idx:] P Q = A[:-1] A[:-1] Q Q = [A[0]] [A[0]] Q XY = [] [] XY x, y = A[1], A[0] A[1] x N = int(input()) int(input()) N ans = P[-1] P[-1] ans P = A[1:] A[1:] P idx = bisect.bisect_left(A, 0) bisect.bisect_left(A, 0) idx
import bisect
N = int(input())
A = sorted(list(map(int, input().split())))
if N == 2:
    x, y = A[1], A[0]
    print(x-y)
    print(x, y)
    exit()
idx = bisect.bisect_left(A, 0)
if idx:
    if idx < N:
        Q = A[:idx]
        P = A[idx:]
    else:
        Q = A[:-1]
        P = [A[-1]]
else:
    Q = [A[0]]
    P = A[1:]


XY = []
LP = len(P)
for i in range(LP-1):
    XY.append((Q[0], P[i]))
    Q[0] -= P[i]
LQ = len(Q)
for i in range(LQ):
    XY.append((P[-1], Q[i]))
    P[-1] = P[-1] - Q[i]
ans = P[-1]
print(ans)
for x, y in XY:
    print(x, y)



