N = int(input())

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

A.sort()

minimum, maximum = A[0], A[-1]
xy = []

for i in range(1,N-1):
    num = A[i]
    if num >= 0:
        xy.append((minimum, num))
        minimum -= num
    else:
        xy.append((maximum, num))
        maximum -= num

xy.append((maximum, minimum))
print(maximum-minimum)
for x, y in xy:
    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 minimum, maximum = A[0], A[-1] minimum A[0] A 0 maximum A[-1] A -1 xy = [] xy [] for i in range(1,N-1):
    num = A[i]
    if num >= 0:
        xy.append((minimum, num))
        minimum -= num
    else:
        xy.append((maximum, num))
        maximum -= num i range(1,N-1) range 1 N-1 N 1 num = A[i] num A[i] A i if num >= 0:
        xy.append((minimum, num))
        minimum -= num
    else:
        xy.append((maximum, num))
        maximum -= num num >= 0 num 0 xy.append((minimum, num)) xy.append xy append (minimum, num) minimum num minimum -= num minimum num xy.append((maximum, num)) xy.append xy append (maximum, num) maximum num maximum -= num maximum num xy.append((maximum, minimum)) xy.append xy append (maximum, minimum) maximum minimum print(maximum-minimum) print maximum-minimum maximum minimum for x, y in xy:
    print(x,y) x y xy print(x,y) print x y maximum = A[0], A[-1] A[-1] maximum minimum -= num num minimum N = int(input()) int(input()) N minimum, maximum = A[0], A[-1] A[0] minimum A = list(map(int, input().split())) list(map(int, input().split())) A maximum -= num num maximum xy = [] [] xy num = A[i] A[i] num
N = int(input())

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

A.sort()

minimum, maximum = A[0], A[-1]
xy = []

for i in range(1,N-1):
    num = A[i]
    if num >= 0:
        xy.append((minimum, num))
        minimum -= num
    else:
        xy.append((maximum, num))
        maximum -= num

xy.append((maximum, minimum))
print(maximum-minimum)
for x, y in xy:
    print(x,y)

