import sys
from bisect import bisect_left
read = sys.stdin.read

N, *A = map(int, read().split())
A.sort()
zero = bisect_left(A, 0)
xy = []
for i in range(1, N - 1):
    if i < zero:
        xy.append((A[-1], A[i]))
        A[-1] -= A[i]
    else:
        xy.append((A[0], A[i]))
        A[0] -= A[i]

print(A[-1] - A[0])
for x, y in xy:
    print(x, y)
print(A[-1], A[0]) import sys sys from bisect import bisect_left read = sys.stdin.read read sys.stdin.read sys.stdin sys stdin read N, *A = map(int, read().split()) N map(int, read().split()) map int read().split() ().split () read split *A A A.sort() A.sort A sort zero = bisect_left(A, 0) zero bisect_left(A, 0) bisect_left A 0 xy = [] xy [] for i in range(1, N - 1):
    if i < zero:
        xy.append((A[-1], A[i]))
        A[-1] -= A[i]
    else:
        xy.append((A[0], A[i]))
        A[0] -= A[i] i range(1, N - 1) range 1 N - 1 N 1 if i < zero:
        xy.append((A[-1], A[i]))
        A[-1] -= A[i]
    else:
        xy.append((A[0], A[i]))
        A[0] -= A[i] i < zero i zero xy.append((A[-1], A[i])) xy.append xy append (A[-1], A[i]) A[-1] A -1 A[i] A i A[-1] -= A[i] A[-1] A -1 A[i] A i xy.append((A[0], A[i])) xy.append xy append (A[0], A[i]) A[0] A 0 A[i] A i A[0] -= A[i] A[0] A 0 A[i] A i print(A[-1] - A[0]) print A[-1] - A[0] A[-1] A -1 A[0] A 0 for x, y in xy:
    print(x, y) x y xy print(x, y) print x y print(A[-1], A[0]) print A[-1] A -1 A[0] A 0 N, *A = map(int, read().split()) map(int, read().split()) N zero = bisect_left(A, 0) bisect_left(A, 0) zero read = sys.stdin.read sys.stdin.read read xy = [] [] xy
import sys
from bisect import bisect_left
read = sys.stdin.read

N, *A = map(int, read().split())
A.sort()
zero = bisect_left(A, 0)
xy = []
for i in range(1, N - 1):
    if i < zero:
        xy.append((A[-1], A[i]))
        A[-1] -= A[i]
    else:
        xy.append((A[0], A[i]))
        A[0] -= A[i]

print(A[-1] - A[0])
for x, y in xy:
    print(x, y)
print(A[-1], A[0])