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

P = [a for a in A if a >= 0]
Q = [a for a in A if a < 0]

if len(P) == 0:
    P = [A[0]]
    Q = A[1:]
if len(Q) == 0:
    P = A[:-1]
    Q = [A[-1]]

print(sum(P) - sum(Q))

for i in range(1, len(P)):
    print(Q[0], P[i])
    Q[0] -= P[i]

for i in range(1, len(Q)):
    print(P[0], Q[i])
    P[0] -= Q[i]

print(P[0], Q[0]) 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.sort(reverse = True) A.sort A sort reverse = True reverse True a for a in A if a >= 0 for a in A if a >= 0 a A a >= 0 a 0 if a >= 0 a P = [a for a in A if a >= 0] P [a for a in A if a >= 0] a for a in A if a < 0 for a in A if a < 0 a A a < 0 a 0 if a < 0 a Q = [a for a in A if a < 0] Q [a for a in A if a < 0] if len(P) == 0:
    P = [A[0]]
    Q = A[1:] len(P) == 0 len(P) len P 0 P = [A[0]] P [A[0]] A[0] A 0 Q = A[1:] Q A[1:] A 1: 1 if len(Q) == 0:
    P = A[:-1]
    Q = [A[-1]] len(Q) == 0 len(Q) len Q 0 P = A[:-1] P A[:-1] A :-1 -1 Q = [A[-1]] Q [A[-1]] A[-1] A -1 print(sum(P) - sum(Q)) print sum(P) - sum(Q) sum(P) sum P sum(Q) sum Q for i in range(1, len(P)):
    print(Q[0], P[i])
    Q[0] -= P[i] i range(1, len(P)) range 1 len(P) len P print(Q[0], P[i]) print Q[0] Q 0 P[i] P i Q[0] -= P[i] Q[0] Q 0 P[i] P i for i in range(1, len(Q)):
    print(P[0], Q[i])
    P[0] -= Q[i] i range(1, len(Q)) range 1 len(Q) len Q print(P[0], Q[i]) print P[0] P 0 Q[i] Q i P[0] -= Q[i] P[0] P 0 Q[i] Q i print(P[0], Q[0]) print P[0] P 0 Q[0] Q 0 P = A[:-1] A[:-1] P N = int(input()) int(input()) N Q = [a for a in A if a < 0] [a for a in A if a < 0] Q Q = [A[-1]] [A[-1]] Q P = [a for a in A if a >= 0] [a for a in A if a >= 0] P A = list(map(int, input().split())) list(map(int, input().split())) A Q = A[1:] A[1:] Q P = [A[0]] [A[0]] P
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse = True)

P = [a for a in A if a >= 0]
Q = [a for a in A if a < 0]

if len(P) == 0:
    P = [A[0]]
    Q = A[1:]
if len(Q) == 0:
    P = A[:-1]
    Q = [A[-1]]

print(sum(P) - sum(Q))

for i in range(1, len(P)):
    print(Q[0], P[i])
    Q[0] -= P[i]

for i in range(1, len(Q)):
    print(P[0], Q[i])
    P[0] -= Q[i]

print(P[0], Q[0])