N = int(input())
A = sorted(list(map(int,input().split())))

p = A[-1]
n = A[0]

ans_list = []

for a in A[1:-1]:
    if a >= 0:
        ans_list.append((n, a))
        n -= a
    else:
        ans_list.append((p, a))
        p -= a

M = p - n
ans_list.append((p, n))

print(M)
for x, y in ans_list:
    print(x, y) N = int(input()) N int(input()) int input() input A = sorted(list(map(int,input().split()))) A sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split p = A[-1] p A[-1] A -1 n = A[0] n A[0] A 0 ans_list = [] ans_list [] for a in A[1:-1]:
    if a >= 0:
        ans_list.append((n, a))
        n -= a
    else:
        ans_list.append((p, a))
        p -= a a A[1:-1] A 1:-1 1 -1 if a >= 0:
        ans_list.append((n, a))
        n -= a
    else:
        ans_list.append((p, a))
        p -= a a >= 0 a 0 ans_list.append((n, a)) ans_list.append ans_list append (n, a) n a n -= a n a ans_list.append((p, a)) ans_list.append ans_list append (p, a) p a p -= a p a M = p - n M p - n p n ans_list.append((p, n)) ans_list.append ans_list append (p, n) p n print(M) print M for x, y in ans_list:
    print(x, y) x y ans_list print(x, y) print x y ans_list = [] [] ans_list p -= a a p N = int(input()) int(input()) N n = A[0] A[0] n n -= a a n p = A[-1] A[-1] p A = sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) A M = p - n p - n M
N = int(input())
A = sorted(list(map(int,input().split())))

p = A[-1]
n = A[0]

ans_list = []

for a in A[1:-1]:
    if a >= 0:
        ans_list.append((n, a))
        n -= a
    else:
        ans_list.append((p, a))
        p -= a

M = p - n
ans_list.append((p, n))

print(M)
for x, y in ans_list:
    print(x, y)