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

from collections import deque
q = deque(A)
mn = q.popleft()
mx = q.pop()

arr = []
for a in q:
    if a >= 0:
        arr.append((mn, a))
        mn -= a
    else:
        arr.append((mx, a))
        mx -= a
arr.append((mx, mn))
print(mx - mn)
for a,b in arr:
    print(a,b) 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 from collections import deque q = deque(A) q deque(A) deque A mn = q.popleft() mn q.popleft() q.popleft q popleft mx = q.pop() mx q.pop() q.pop q pop arr = [] arr [] for a in q:
    if a >= 0:
        arr.append((mn, a))
        mn -= a
    else:
        arr.append((mx, a))
        mx -= a a q if a >= 0:
        arr.append((mn, a))
        mn -= a
    else:
        arr.append((mx, a))
        mx -= a a >= 0 a 0 arr.append((mn, a)) arr.append arr append (mn, a) mn a mn -= a mn a arr.append((mx, a)) arr.append arr append (mx, a) mx a mx -= a mx a arr.append((mx, mn)) arr.append arr append (mx, mn) mx mn print(mx - mn) print mx - mn mx mn for a,b in arr:
    print(a,b) a b arr print(a,b) print a b q = deque(A) deque(A) q mn = q.popleft() q.popleft() mn mx = q.pop() q.pop() mx mn -= a a mn mx -= a a mx A = list(map(int,input().split())) list(map(int,input().split())) A arr = [] [] arr N = int(input()) int(input()) N
N = int(input())
A = list(map(int,input().split()))
A.sort()

from collections import deque
q = deque(A)
mn = q.popleft()
mx = q.pop()

arr = []
for a in q:
    if a >= 0:
        arr.append((mn, a))
        mn -= a
    else:
        arr.append((mx, a))
        mx -= a
arr.append((mx, mn))
print(mx - mn)
for a,b in arr:
    print(a,b)