import sys
input=sys.stdin.readline
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=[]

if A[0]>0:
    num=A[0]
    for i in range(1,N-1):
        ans.append([num,A[i]])
        num-=A[i]
    ans.append([A[-1],num])
    print(A[-1]-num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
elif A[-1]<0:
    A.sort(reverse=True)
    num=A[0]
    for i in range(1,N):
        ans.append([num,A[i]])
        num-=A[i]
    print(num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
else:
    M=A[-1]
    m=A[0]
    for i in range(1,N-1):
        if A[i]<0:
            ans.append([M,A[i]])
            M-=A[i]
        else:
            ans.append([m,A[i]])
            m-=A[i]
    ans.append([M,m])
    print(M-m)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1]) import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 ans=[] ans [] if A[0]>0:
    num=A[0]
    for i in range(1,N-1):
        ans.append([num,A[i]])
        num-=A[i]
    ans.append([A[-1],num])
    print(A[-1]-num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
elif A[-1]<0:
    A.sort(reverse=True)
    num=A[0]
    for i in range(1,N):
        ans.append([num,A[i]])
        num-=A[i]
    print(num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
else:
    M=A[-1]
    m=A[0]
    for i in range(1,N-1):
        if A[i]<0:
            ans.append([M,A[i]])
            M-=A[i]
        else:
            ans.append([m,A[i]])
            m-=A[i]
    ans.append([M,m])
    print(M-m)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1]) A[0]>0 A[0] A 0 0 num=A[0] num A[0] A 0 for i in range(1,N-1):
        ans.append([num,A[i]])
        num-=A[i]
     i range(1,N-1) range 1 N-1 N 1 ans.append([num,A[i]]) ans.append ans append [num,A[i]] num A[i] A i num-=A[i] num A[i] A i ans.append([A[-1],num]) ans.append ans append [A[-1],num] A[-1] A -1 num print(A[-1]-num) print A[-1]-num A[-1] A -1 num for i in range(len(ans)):
        print(ans[i][0],ans[i][1]) i range(len(ans)) range len(ans) len ans print(ans[i][0],ans[i][1]) print ans[i][0] [i] ans i 0 ans[i][1] [i] ans i 1 elif A[-1]<0:
    A.sort(reverse=True)
    num=A[0]
    for i in range(1,N):
        ans.append([num,A[i]])
        num-=A[i]
    print(num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1]) A[-1]<0 A[-1] A -1 0 A.sort(reverse=True) A.sort A sort reverse=True reverse True num=A[0] num A[0] A 0 for i in range(1,N):
        ans.append([num,A[i]])
        num-=A[i]
     i range(1,N) range 1 N ans.append([num,A[i]]) ans.append ans append [num,A[i]] num A[i] A i num-=A[i] num A[i] A i print(num) print num for i in range(len(ans)):
        print(ans[i][0],ans[i][1]) i range(len(ans)) range len(ans) len ans print(ans[i][0],ans[i][1]) print ans[i][0] [i] ans i 0 ans[i][1] [i] ans i 1 M=A[-1] M A[-1] A -1 m=A[0] m A[0] A 0 for i in range(1,N-1):
        if A[i]<0:
            ans.append([M,A[i]])
            M-=A[i]
        else:
            ans.append([m,A[i]])
            m-=A[i]
     i range(1,N-1) range 1 N-1 N 1 if A[i]<0:
            ans.append([M,A[i]])
            M-=A[i]
        else:
            ans.append([m,A[i]])
            m-=A[i]
     A[i]<0 A[i] A i 0 ans.append([M,A[i]]) ans.append ans append [M,A[i]] M A[i] A i M-=A[i] M A[i] A i ans.append([m,A[i]]) ans.append ans append [m,A[i]] m A[i] A i m-=A[i] m A[i] A i ans.append([M,m]) ans.append ans append [M,m] M m print(M-m) print M-m M m for i in range(len(ans)):
        print(ans[i][0],ans[i][1]) i range(len(ans)) range len(ans) len ans print(ans[i][0],ans[i][1]) print ans[i][0] [i] ans i 0 ans[i][1] [i] ans i 1 N=int(input()) int(input()) N num-=A[i] A[i] num A=list(map(int,input().split())) list(map(int,input().split())) A num=A[0] A[0] num M=A[-1] A[-1] M num-=A[i] A[i] num m=A[0] A[0] m M-=A[i] A[i] M m-=A[i] A[i] m num=A[0] A[0] num input=sys.stdin.readline sys.stdin.readline input ans=[] [] ans
import sys
input=sys.stdin.readline
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=[]

if A[0]>0:
    num=A[0]
    for i in range(1,N-1):
        ans.append([num,A[i]])
        num-=A[i]
    ans.append([A[-1],num])
    print(A[-1]-num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
elif A[-1]<0:
    A.sort(reverse=True)
    num=A[0]
    for i in range(1,N):
        ans.append([num,A[i]])
        num-=A[i]
    print(num)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])
else:
    M=A[-1]
    m=A[0]
    for i in range(1,N-1):
        if A[i]<0:
            ans.append([M,A[i]])
            M-=A[i]
        else:
            ans.append([m,A[i]])
            m-=A[i]
    ans.append([M,m])
    print(M-m)
    for i in range(len(ans)):
        print(ans[i][0],ans[i][1])