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