n = int(input())
a = list(map(int, input().split()))
a.sort()
q = 0
for ai in a:
    if ai < 0:
        q += 1
    else:
        break
if q == 0:
    q = 1
elif q == n:
    q = n - 1
ans = []
x = a[0]
for ai in a[q:-1]:
    ans.append([x, ai])
    x -= ai

ans.append([a[-1], x])
y = a[-1] - x

for ai in a[1:q]:
    ans.append([y, ai])
    y -= ai

print(y)
for i in ans:
    print(*i) 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 q = 0 q 0 for ai in a:
    if ai < 0:
        q += 1
    else:
        break ai a if ai < 0:
        q += 1
    else:
        break ai < 0 ai 0 q += 1 q 1 break if q == 0:
    q = 1
elif q == n:
    q = n - 1 q == 0 q 0 q = 1 q 1 elif q == n:
    q = n - 1 q == n q n q = n - 1 q n - 1 n 1 ans = [] ans [] x = a[0] x a[0] a 0 for ai in a[q:-1]:
    ans.append([x, ai])
    x -= ai ai a[q:-1] a q:-1 q -1 ans.append([x, ai]) ans.append ans append [x, ai] x ai x -= ai x ai ans.append([a[-1], x]) ans.append ans append [a[-1], x] a[-1] a -1 x y = a[-1] - x y a[-1] - x a[-1] a -1 x for ai in a[1:q]:
    ans.append([y, ai])
    y -= ai ai a[1:q] a 1:q 1 q ans.append([y, ai]) ans.append ans append [y, ai] y ai y -= ai y ai print(y) print y for i in ans:
    print(*i) i ans print(*i) print *i i q += 1 1 q x = a[0] a[0] x ans = [] [] ans y = a[-1] - x a[-1] - x y y -= ai ai y q = 1 1 q n = int(input()) int(input()) n q = n - 1 n - 1 q x -= ai ai x a = list(map(int, input().split())) list(map(int, input().split())) a q = 0 0 q
n = int(input())
a = list(map(int, input().split()))
a.sort()
q = 0
for ai in a:
    if ai < 0:
        q += 1
    else:
        break
if q == 0:
    q = 1
elif q == n:
    q = n - 1
ans = []
x = a[0]
for ai in a[q:-1]:
    ans.append([x, ai])
    x -= ai

ans.append([a[-1], x])
y = a[-1] - x

for ai in a[1:q]:
    ans.append([y, ai])
    y -= ai

print(y)
for i in ans:
    print(*i)
