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

P = [x for x in A if x >= 0]
M = [x for x in A if x < 0]

if not len(P):
    P.append(A[0])
    M = M[1:]
elif not len(M):
    P.pop()
    M.append(A[-1])

print(sum(P) - sum(M))
# -
x = M[0]
for i in range(1, len(P)):
    print(x, P[i])
    x -= P[i]

# +
y = P[0]
for i in range(1, len(M)):
    print(y, M[i])
    y -= M[i]
print(y, x) N = int(input()) N int(input()) int input() input A = sorted(list(map(int, input().split())), reverse=True) A sorted(list(map(int, input().split())), reverse=True) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split reverse=True reverse True x for x in A if x >= 0 for x in A if x >= 0 x A x >= 0 x 0 if x >= 0 x P = [x for x in A if x >= 0] P [x for x in A if x >= 0] x for x in A if x < 0 for x in A if x < 0 x A x < 0 x 0 if x < 0 x M = [x for x in A if x < 0] M [x for x in A if x < 0] if not len(P):
    P.append(A[0])
    M = M[1:]
elif not len(M):
    P.pop()
    M.append(A[-1]) not len(P) len(P) len P P.append(A[0]) P.append P append A[0] A 0 M = M[1:] M M[1:] M 1: 1 elif not len(M):
    P.pop()
    M.append(A[-1]) not len(M) len(M) len M P.pop() P.pop P pop M.append(A[-1]) M.append M append A[-1] A -1 print(sum(P) - sum(M)) print sum(P) - sum(M) sum(P) sum P sum(M) sum M x = M[0] x M[0] M 0 for i in range(1, len(P)):
    print(x, P[i])
    x -= P[i]

# + i range(1, len(P)) range 1 len(P) len P print(x, P[i]) print x P[i] P i x -= P[i] x P[i] P i y = P[0] y P[0] P 0 for i in range(1, len(M)):
    print(y, M[i])
    y -= M[i] i range(1, len(M)) range 1 len(M) len M print(y, M[i]) print y M[i] M i y -= M[i] y M[i] M i print(y, x) print y x x -= P[i] P[i] x N = int(input()) int(input()) N P = [x for x in A if x >= 0] [x for x in A if x >= 0] P M = [x for x in A if x < 0] [x for x in A if x < 0] M y -= M[i] M[i] y y = P[0] P[0] y M = M[1:] M[1:] M A = sorted(list(map(int, input().split())), reverse=True) sorted(list(map(int, input().split())), reverse=True) A x = M[0] M[0] x
N = int(input())
A = sorted(list(map(int, input().split())), reverse=True)

P = [x for x in A if x >= 0]
M = [x for x in A if x < 0]

if not len(P):
    P.append(A[0])
    M = M[1:]
elif not len(M):
    P.pop()
    M.append(A[-1])

print(sum(P) - sum(M))
# -
x = M[0]
for i in range(1, len(P)):
    print(x, P[i])
    x -= P[i]

# +
y = P[0]
for i in range(1, len(M)):
    print(y, M[i])
    y -= M[i]
print(y, x)
