N=int(input())
A=sorted(map(int,input().split()))
m,M=A[0],A[-1]
L=[]

for i in range(1,N-1):
    v=A[i]
    if v>=0:
        L.append((m,v))
        m-=v
    else:
        L.append((M,v))
        M-=v
L.append((M,m))
ans=M-m

print(ans)
for a,b in L:
    print(a,b) N=int(input()) N int(input()) int input() input A=sorted(map(int,input().split())) A sorted(map(int,input().split())) sorted map(int,input().split()) map int input().split() ().split () input split m,M=A[0],A[-1] m A[0] A 0 M A[-1] A -1 L=[] L [] for i in range(1,N-1):
    v=A[i]
    if v>=0:
        L.append((m,v))
        m-=v
    else:
        L.append((M,v))
        M-=v i range(1,N-1) range 1 N-1 N 1 v=A[i] v A[i] A i if v>=0:
        L.append((m,v))
        m-=v
    else:
        L.append((M,v))
        M-=v v>=0 v 0 L.append((m,v)) L.append L append (m,v) m v m-=v m v L.append((M,v)) L.append L append (M,v) M v M-=v M v L.append((M,m)) L.append L append (M,m) M m ans=M-m ans M-m M m print(ans) print ans for a,b in L:
    print(a,b) a b L print(a,b) print a b A=sorted(map(int,input().split())) sorted(map(int,input().split())) A m,M=A[0],A[-1] A[0] m M=A[0],A[-1] A[-1] M v=A[i] A[i] v N=int(input()) int(input()) N ans=M-m M-m ans M-=v v M L=[] [] L m-=v v m
N=int(input())
A=sorted(map(int,input().split()))
m,M=A[0],A[-1]
L=[]

for i in range(1,N-1):
    v=A[i]
    if v>=0:
        L.append((m,v))
        m-=v
    else:
        L.append((M,v))
        M-=v
L.append((M,m))
ans=M-m

print(ans)
for a,b in L:
    print(a,b)