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 = []
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 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 [] minimum = A[0] minimum A[0] A 0 maximum = A[-1] maximum A[-1] 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)) i range(1, N - 1) range 1 N - 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] i < zero i zero xy.append(str(maximum) + ' ' + str(A[i])) xy.append xy append str(maximum) + ' ' + str(A[i]) str(maximum) + ' ' str(maximum) str maximum ' ' str(A[i]) str A[i] A i maximum -= A[i] maximum A[i] A i xy.append((str(minimum) + ' ' + str(A[i]))) xy.append xy append str(minimum) + ' ' + str(A[i]) str(minimum) + ' ' str(minimum) str minimum ' ' str(A[i]) str A[i] A i minimum -= A[i] minimum A[i] A i xy.append(str(maximum) + ' ' + str(minimum)) xy.append xy append str(maximum) + ' ' + str(minimum) str(maximum) + ' ' str(maximum) str maximum ' ' str(minimum) str minimum print(maximum - minimum) print maximum - minimum maximum minimum print('\n'.join(xy)) print '\n'.join(xy) '\n'.join '\n' join xy minimum = A[0] A[0] minimum read = sys.stdin.read sys.stdin.read read maximum -= A[i] A[i] maximum zero = bisect_left(A, 0) bisect_left(A, 0) zero maximum = A[-1] A[-1] maximum xy = [] [] xy N, *A = map(int, read().split()) map(int, read().split()) N minimum -= A[i] A[i] minimum
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 = []
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))