import bisect

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

neg = [A[0]]
pos = [A[-1]]
if N >= 3:
    i = bisect.bisect_left(A, 0, lo=1, hi=N - 1)
    neg += A[1:i]
    pos += A[i:N - 1]

M = neg.pop()
Op = []
for i in range(len(pos) - 1):
    p = pos.pop()
    Op.append((M, p))
    M -= p
p = pos.pop()
Op.append((p, M))
M = p - M
for i in range(len(neg)):
    n = neg.pop()
    Op.append((M, n))
    M -= n

print(M)
for O in Op:
    print(O[0], O[1]) 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 A.sort() A.sort A sort neg = [A[0]] neg [A[0]] A[0] A 0 pos = [A[-1]] pos [A[-1]] A[-1] A -1 if N >= 3:
    i = bisect.bisect_left(A, 0, lo=1, hi=N - 1)
    neg += A[1:i]
    pos += A[i:N - 1] N >= 3 N 3 i = bisect.bisect_left(A, 0, lo=1, hi=N - 1) i bisect.bisect_left(A, 0, lo=1, hi=N - 1) bisect.bisect_left bisect bisect_left A 0 lo=1 lo 1 hi=N - 1 hi N - 1 N 1 neg += A[1:i] neg A[1:i] A 1:i 1 i pos += A[i:N - 1] pos A[i:N - 1] A i:N - 1 i N - 1 N 1 M = neg.pop() M neg.pop() neg.pop neg pop Op = [] Op [] for i in range(len(pos) - 1):
    p = pos.pop()
    Op.append((M, p))
    M -= p i range(len(pos) - 1) range len(pos) - 1 len(pos) len pos 1 p = pos.pop() p pos.pop() pos.pop pos pop Op.append((M, p)) Op.append Op append (M, p) M p M -= p M p p = pos.pop() p pos.pop() pos.pop pos pop Op.append((p, M)) Op.append Op append (p, M) p M M = p - M M p - M p M for i in range(len(neg)):
    n = neg.pop()
    Op.append((M, n))
    M -= n i range(len(neg)) range len(neg) len neg n = neg.pop() n neg.pop() neg.pop neg pop Op.append((M, n)) Op.append Op append (M, n) M n M -= n M n print(M) print M for O in Op:
    print(O[0], O[1]) O Op print(O[0], O[1]) print O[0] O 0 O[1] O 1 i = bisect.bisect_left(A, 0, lo=1, hi=N - 1) bisect.bisect_left(A, 0, lo=1, hi=N - 1) i M = p - M p - M M p = pos.pop() pos.pop() p n = neg.pop() neg.pop() n pos = [A[-1]] [A[-1]] pos M = neg.pop() neg.pop() M pos += A[i:N - 1] A[i:N - 1] pos N = int(input()) int(input()) N M -= n n M neg += A[1:i] A[1:i] neg Op = [] [] Op M -= p p M A = list(map(int, input().split())) list(map(int, input().split())) A neg = [A[0]] [A[0]] neg p = pos.pop() pos.pop() p
import bisect

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

neg = [A[0]]
pos = [A[-1]]
if N >= 3:
    i = bisect.bisect_left(A, 0, lo=1, hi=N - 1)
    neg += A[1:i]
    pos += A[i:N - 1]

M = neg.pop()
Op = []
for i in range(len(pos) - 1):
    p = pos.pop()
    Op.append((M, p))
    M -= p
p = pos.pop()
Op.append((p, M))
M = p - M
for i in range(len(neg)):
    n = neg.pop()
    Op.append((M, n))
    M -= n

print(M)
for O in Op:
    print(O[0], O[1])
