from collections import deque
n=int(input())
A=sorted(list(map(int,input().split())))
A=deque(A)

N=[]
left,right=A.popleft(),A.pop()
for i in A:
    if i<0:
        N.append([right,i])
        right -=i
    else:
        N.append([left,i])
        left -=i
N.append([right,left])
print(right-left)
for i in N:print(*i) from collections import deque n=int(input()) n int(input()) int input() input A=sorted(list(map(int,input().split()))) A sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split A=deque(A) A deque(A) deque A N=[] N [] left,right=A.popleft(),A.pop() left A.popleft() A.popleft A popleft right A.pop() A.pop A pop for i in A:
    if i<0:
        N.append([right,i])
        right -=i
    else:
        N.append([left,i])
        left -=i i A if i<0:
        N.append([right,i])
        right -=i
    else:
        N.append([left,i])
        left -=i i<0 i 0 N.append([right,i]) N.append N append [right,i] right i right -=i right i N.append([left,i]) N.append N append [left,i] left i left -=i left i N.append([right,left]) N.append N append [right,left] right left print(right-left) print right-left right left for i in N:print(*i) i N n=int(input()) int(input()) n A=deque(A) deque(A) A left,right=A.popleft(),A.pop() A.popleft() left right=A.popleft(),A.pop() A.pop() right A=sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) A left -=i i left N=[] [] N right -=i i right
from collections import deque
n=int(input())
A=sorted(list(map(int,input().split())))
A=deque(A)

N=[]
left,right=A.popleft(),A.pop()
for i in A:
    if i<0:
        N.append([right,i])
        right -=i
    else:
        N.append([left,i])
        left -=i
N.append([right,left])
print(right-left)
for i in N:print(*i)