import bisect
N = int(input())
A = sorted([int(_) for _ in input().split()])
i = bisect.bisect_left(A, 0)
if i == N:
    i -= 2
elif i:
    i -= 1
now = A[i]
ans = []
for a in A[i + 1:N - 1]:
    ans += [[now, a]]
    now -= a
ans += [[A[N - 1], now]]
now = A[N - 1] - now
for a in A[:i]:
    ans += [[now, a]]
    now -= a
print(now)
[print(*xy) for xy in ans] import bisect bisect N = int(input()) N int(input()) int input() input int(_) for _ in input().split() for _ in input().split() _ input().split() ().split () input split for _ in input().split() int(_) int _ A = sorted([int(_) for _ in input().split()]) A sorted([int(_) for _ in input().split()]) sorted [int(_) for _ in input().split()] i = bisect.bisect_left(A, 0) i bisect.bisect_left(A, 0) bisect.bisect_left bisect bisect_left A 0 if i == N:
    i -= 2
elif i:
    i -= 1 i == N i N i -= 2 i 2 elif i:
    i -= 1 i i -= 1 i 1 now = A[i] now A[i] A i ans = [] ans [] for a in A[i + 1:N - 1]:
    ans += [[now, a]]
    now -= a a A[i + 1:N - 1] A i + 1:N - 1 i + 1 i 1 N - 1 N 1 ans += [[now, a]] ans [[now, a]] [now, a] now a now -= a now a ans += [[A[N - 1], now]] ans [[A[N - 1], now]] [A[N - 1], now] A[N - 1] A N - 1 N 1 now now = A[N - 1] - now now A[N - 1] - now A[N - 1] A N - 1 N 1 now for a in A[:i]:
    ans += [[now, a]]
    now -= a a A[:i] A :i i ans += [[now, a]] ans [[now, a]] [now, a] now a now -= a now a print(now) print now print(*xy) for xy in ans for xy in ans xy ans for xy in ans print(*xy) print *xy xy [print(*xy) for xy in ans] N = int(input()) int(input()) N i -= 1 1 i ans += [[A[N - 1], now]] [[A[N - 1], now]] ans now = A[i] A[i] now ans = [] [] ans ans += [[now, a]] [[now, a]] ans i = bisect.bisect_left(A, 0) bisect.bisect_left(A, 0) i A = sorted([int(_) for _ in input().split()]) sorted([int(_) for _ in input().split()]) A now -= a a now i -= 2 2 i now -= a a now ans += [[now, a]] [[now, a]] ans now = A[N - 1] - now A[N - 1] - now now
import bisect
N = int(input())
A = sorted([int(_) for _ in input().split()])
i = bisect.bisect_left(A, 0)
if i == N:
    i -= 2
elif i:
    i -= 1
now = A[i]
ans = []
for a in A[i + 1:N - 1]:
    ans += [[now, a]]
    now -= a
ans += [[A[N - 1], now]]
now = A[N - 1] - now
for a in A[:i]:
    ans += [[now, a]]
    now -= a
print(now)
[print(*xy) for xy in ans]
