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

A.sort()

m = A[0]
M = A[-1]
ans = list()
for a in A[1: -1]:
    if a < 0:
        ans.append((M, a))
        M = M - a
    else:
        ans.append((m, a))
        m = m - a
ans.append((M, m))
print(M - m)
for x, y in ans:
    print(x, y) 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 m = A[0] m A[0] A 0 M = A[-1] M A[-1] A -1 ans = list() ans list() list for a in A[1: -1]:
    if a < 0:
        ans.append((M, a))
        M = M - a
    else:
        ans.append((m, a))
        m = m - a a A[1: -1] A 1: -1 1 -1 if a < 0:
        ans.append((M, a))
        M = M - a
    else:
        ans.append((m, a))
        m = m - a a < 0 a 0 ans.append((M, a)) ans.append ans append (M, a) M a M = M - a M M - a M a ans.append((m, a)) ans.append ans append (m, a) m a m = m - a m m - a m a ans.append((M, m)) ans.append ans append (M, m) M m print(M - m) print M - m M m for x, y in ans:
    print(x, y) x y ans print(x, y) print x y m = m - a m - a m M = M - a M - a M A = list(map(int, input().split())) list(map(int, input().split())) A M = A[-1] A[-1] M ans = list() list() ans N = int(input()) int(input()) N m = A[0] A[0] m
N = int(input())
A = list(map(int, input().split()))

A.sort()

m = A[0]
M = A[-1]
ans = list()
for a in A[1: -1]:
    if a < 0:
        ans.append((M, a))
        M = M - a
    else:
        ans.append((m, a))
        m = m - a
ans.append((M, m))
print(M - m)
for x, y in ans:
    print(x, y)