n = int(input())
s = n % 2
a = list(map(int, input().split()))
a.sort()
mi = a[0]
ma = a[n - 1]
l = []
for i in range(1, n - 1):
    if a[i] < 0:
        l.append((ma, a[i]))
        ma -= a[i]
    else:
        l.append((mi, a[i]))
        mi -= a[i]
l.append((ma, mi))
print(ma - mi)
for x, y in l:
    print(x, y) n = int(input()) n int(input()) int input() input s = n % 2 s n % 2 n 2 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 mi = a[0] mi a[0] a 0 ma = a[n - 1] ma a[n - 1] a n - 1 n 1 l = [] l [] for i in range(1, n - 1):
    if a[i] < 0:
        l.append((ma, a[i]))
        ma -= a[i]
    else:
        l.append((mi, a[i]))
        mi -= a[i] i range(1, n - 1) range 1 n - 1 n 1 if a[i] < 0:
        l.append((ma, a[i]))
        ma -= a[i]
    else:
        l.append((mi, a[i]))
        mi -= a[i] a[i] < 0 a[i] a i 0 l.append((ma, a[i])) l.append l append (ma, a[i]) ma a[i] a i ma -= a[i] ma a[i] a i l.append((mi, a[i])) l.append l append (mi, a[i]) mi a[i] a i mi -= a[i] mi a[i] a i l.append((ma, mi)) l.append l append (ma, mi) ma mi print(ma - mi) print ma - mi ma mi for x, y in l:
    print(x, y) x y l print(x, y) print x y s = n % 2 n % 2 s ma = a[n - 1] a[n - 1] ma a = list(map(int, input().split())) list(map(int, input().split())) a l = [] [] l ma -= a[i] a[i] ma n = int(input()) int(input()) n mi -= a[i] a[i] mi mi = a[0] a[0] mi
n = int(input())
s = n % 2
a = list(map(int, input().split()))
a.sort()
mi = a[0]
ma = a[n - 1]
l = []
for i in range(1, n - 1):
    if a[i] < 0:
        l.append((ma, a[i]))
        ma -= a[i]
    else:
        l.append((mi, a[i]))
        mi -= a[i]
l.append((ma, mi))
print(ma - mi)
for x, y in l:
    print(x, y)