N = int(input())
a = list(map(int, input().split()))
a.sort()
ans = []
if a[0] > 0:
    x = a[0]
    for i in range(1, N - 1):
        ans.append((x, a[i]))
        x -= a[i]
    ans.append((a[-1], x))
    x = a[-1] - x
elif a[-1] < 0:
    x = a[-1]
    for i in range(N - 2, -1, -1):
        ans.append((x, a[i]))
        x -= a[i]
else:
    x = a[0]
    for i in range(1, N - 1):
        if a[i] >= 0:
            ans.append((x, a[i]))
            x -= a[i]
    ans.append((a[-1], x))
    x = a[-1] - x
    for i in range(1, N - 1):
        if a[i] < 0:
            ans.append((x, a[i]))
            x -= a[i]

print(x)
for a, b in ans:
    print(a, b) 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 = [] ans [] if a[0] > 0:
    x = a[0]
    for i in range(1, N - 1):
        ans.append((x, a[i]))
        x -= a[i]
    ans.append((a[-1], x))
    x = a[-1] - x
elif a[-1] < 0:
    x = a[-1]
    for i in range(N - 2, -1, -1):
        ans.append((x, a[i]))
        x -= a[i]
else:
    x = a[0]
    for i in range(1, N - 1):
        if a[i] >= 0:
            ans.append((x, a[i]))
            x -= a[i]
    ans.append((a[-1], x))
    x = a[-1] - x
    for i in range(1, N - 1):
        if a[i] < 0:
            ans.append((x, a[i]))
            x -= a[i] a[0] > 0 a[0] a 0 0 x = a[0] x a[0] a 0 for i in range(1, N - 1):
        ans.append((x, a[i]))
        x -= a[i]
     i range(1, N - 1) range 1 N - 1 N 1 ans.append((x, a[i])) ans.append ans append (x, a[i]) x a[i] a i x -= a[i] x a[i] a i ans.append((a[-1], x)) ans.append ans append (a[-1], x) a[-1] a -1 x x = a[-1] - x x a[-1] - x a[-1] a -1 x elif a[-1] < 0:
    x = a[-1]
    for i in range(N - 2, -1, -1):
        ans.append((x, a[i]))
        x -= a[i] a[-1] < 0 a[-1] a -1 0 x = a[-1] x a[-1] a -1 for i in range(N - 2, -1, -1):
        ans.append((x, a[i]))
        x -= a[i] i range(N - 2, -1, -1) range N - 2 N 2 -1 -1 ans.append((x, a[i])) ans.append ans append (x, a[i]) x a[i] a i x -= a[i] x a[i] a i x = a[0] x a[0] a 0 for i in range(1, N - 1):
        if a[i] >= 0:
            ans.append((x, a[i]))
            x -= a[i]
     i range(1, N - 1) range 1 N - 1 N 1 if a[i] >= 0:
            ans.append((x, a[i]))
            x -= a[i]
     a[i] >= 0 a[i] a i 0 ans.append((x, a[i])) ans.append ans append (x, a[i]) x a[i] a i x -= a[i] x a[i] a i ans.append((a[-1], x)) ans.append ans append (a[-1], x) a[-1] a -1 x x = a[-1] - x x a[-1] - x a[-1] a -1 x for i in range(1, N - 1):
        if a[i] < 0:
            ans.append((x, a[i]))
            x -= a[i] i range(1, N - 1) range 1 N - 1 N 1 if a[i] < 0:
            ans.append((x, a[i]))
            x -= a[i] a[i] < 0 a[i] a i 0 ans.append((x, a[i])) ans.append ans append (x, a[i]) x a[i] a i x -= a[i] x a[i] a i print(x) print x for a, b in ans:
    print(a, b) a b ans print(a, b) print a b x -= a[i] a[i] x N = int(input()) int(input()) N x -= a[i] a[i] x x = a[-1] - x a[-1] - x x x = a[-1] a[-1] x x = a[-1] - x a[-1] - x x x = a[0] a[0] x a = list(map(int, input().split())) list(map(int, input().split())) a x -= a[i] a[i] x x -= a[i] a[i] x x = a[0] a[0] x ans = [] [] ans
N = int(input())
a = list(map(int, input().split()))
a.sort()
ans = []
if a[0] > 0:
    x = a[0]
    for i in range(1, N - 1):
        ans.append((x, a[i]))
        x -= a[i]
    ans.append((a[-1], x))
    x = a[-1] - x
elif a[-1] < 0:
    x = a[-1]
    for i in range(N - 2, -1, -1):
        ans.append((x, a[i]))
        x -= a[i]
else:
    x = a[0]
    for i in range(1, N - 1):
        if a[i] >= 0:
            ans.append((x, a[i]))
            x -= a[i]
    ans.append((a[-1], x))
    x = a[-1] - x
    for i in range(1, N - 1):
        if a[i] < 0:
            ans.append((x, a[i]))
            x -= a[i]

print(x)
for a, b in ans:
    print(a, b)