from bisect import bisect_left

N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = sum(abs(a) for a in A)
if A[0] >= 0:
    ans -= 2 * A[0]
elif A[-1] < 0:
    ans += 2 * A[-1]
print(ans)
nonneg_idx = bisect_left(A, 0)
if nonneg_idx == 0:
    nonneg_idx = 1
elif nonneg_idx == N:
    nonneg_idx = N - 1
acc = A[nonneg_idx - 1]
for a in A[nonneg_idx + 1 :]:
    print(acc, a)
    acc -= a
print(A[nonneg_idx], acc)
acc = A[nonneg_idx] - acc
for a in A[: nonneg_idx - 1]:
    print(acc, a)
    acc -= a from bisect import bisect_left 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 ans = sum(abs(a) for a in A) ans sum(abs(a) for a in A) sum abs(a) abs a if A[0] >= 0:
    ans -= 2 * A[0]
elif A[-1] < 0:
    ans += 2 * A[-1] A[0] >= 0 A[0] A 0 0 ans -= 2 * A[0] ans 2 * A[0] 2 A[0] A 0 elif A[-1] < 0:
    ans += 2 * A[-1] A[-1] < 0 A[-1] A -1 0 ans += 2 * A[-1] ans 2 * A[-1] 2 A[-1] A -1 print(ans) print ans nonneg_idx = bisect_left(A, 0) nonneg_idx bisect_left(A, 0) bisect_left A 0 if nonneg_idx == 0:
    nonneg_idx = 1
elif nonneg_idx == N:
    nonneg_idx = N - 1 nonneg_idx == 0 nonneg_idx 0 nonneg_idx = 1 nonneg_idx 1 elif nonneg_idx == N:
    nonneg_idx = N - 1 nonneg_idx == N nonneg_idx N nonneg_idx = N - 1 nonneg_idx N - 1 N 1 acc = A[nonneg_idx - 1] acc A[nonneg_idx - 1] A nonneg_idx - 1 nonneg_idx 1 for a in A[nonneg_idx + 1 :]:
    print(acc, a)
    acc -= a a A[nonneg_idx + 1 :] A nonneg_idx + 1 : nonneg_idx + 1 nonneg_idx 1 print(acc, a) print acc a acc -= a acc a print(A[nonneg_idx], acc) print A[nonneg_idx] A nonneg_idx acc acc = A[nonneg_idx] - acc acc A[nonneg_idx] - acc A[nonneg_idx] A nonneg_idx acc for a in A[: nonneg_idx - 1]:
    print(acc, a)
    acc -= a a A[: nonneg_idx - 1] A : nonneg_idx - 1 nonneg_idx - 1 nonneg_idx 1 print(acc, a) print acc a acc -= a acc a ans -= 2 * A[0] 2 * A[0] ans ans += 2 * A[-1] 2 * A[-1] ans nonneg_idx = 1 1 nonneg_idx acc = A[nonneg_idx - 1] A[nonneg_idx - 1] acc acc -= a a acc N = int(input()) int(input()) N acc = A[nonneg_idx] - acc A[nonneg_idx] - acc acc A = list(map(int, input().split())) list(map(int, input().split())) A nonneg_idx = N - 1 N - 1 nonneg_idx ans = sum(abs(a) for a in A) sum(abs(a) for a in A) ans nonneg_idx = bisect_left(A, 0) bisect_left(A, 0) nonneg_idx acc -= a a acc
from bisect import bisect_left

N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = sum(abs(a) for a in A)
if A[0] >= 0:
    ans -= 2 * A[0]
elif A[-1] < 0:
    ans += 2 * A[-1]
print(ans)
nonneg_idx = bisect_left(A, 0)
if nonneg_idx == 0:
    nonneg_idx = 1
elif nonneg_idx == N:
    nonneg_idx = N - 1
acc = A[nonneg_idx - 1]
for a in A[nonneg_idx + 1 :]:
    print(acc, a)
    acc -= a
print(A[nonneg_idx], acc)
acc = A[nonneg_idx] - acc
for a in A[: nonneg_idx - 1]:
    print(acc, a)
    acc -= a
