import sys

from bisect import bisect_left

read = sys.stdin.read



N, *A = list(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

from bisect import bisect_left

read = sys.stdin.read



N, *A = list(map(int, read().split()))

A.sort()

zero = bisect_left(A, 0)

xy = []

minimum = A[0]

maximum = A[-1]

for i in range(1, N - 1):

    if i < zero:

        xy.append(str(maximum) + ' ' + str(A[i]))

        maximum -= A[i]

    else:

        xy.append((str(minimum) + ' ' + str(A[i])))

        minimum -= A[i]

else:

    xy.append(str(maximum) + ' ' + str(minimum))



print((maximum - minimum))

print(('\n'.join(xy)))
import sys
from bisect import bisect_left

read = sys.stdin.read
N, *A = list(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
from bisect import bisect_left

read = sys.stdin.read
N, *A = list(map(int, read().split()))
A.sort()
zero = bisect_left(A, 0)
xy = []
minimum = A[0]
maximum = A[-1]
for i in range(1, N - 1):
    if i < zero:
        xy.append(str(maximum) + " " + str(A[i]))
        maximum -= A[i]
    else:
        xy.append((str(minimum) + " " + str(A[i])))
        minimum -= A[i]
else:
    xy.append(str(maximum) + " " + str(minimum))
print((maximum - minimum))
print(("\n".join(xy)))

+minimum = A[0] +maximum = A[-1] -        xy.append((A[-1], A[i])) -        A[-1] -= A[i] +        xy.append(str(maximum) + " " + str(A[i])) +        maximum -= A[i] -        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])) +        xy.append((str(minimum) + " " + str(A[i]))) +        minimum -= A[i] +else: +    xy.append(str(maximum) + " " + str(minimum)) +print((maximum - minimum)) +print(("\n".join(xy)))