N=int(input())
A=list(map(int,input().split()))
A.sort()
m=A[0]
if m>=0:
    M=sum(A)-2*m
    print(M)
    s=A[0]
    for i in range(0,N-1):
        if i!=N-2:
            print(s,A[i+1])
            s-=A[i+1]
        else:
            print(A[N-1],s)
else:
    if A[N-1]>0:
        start=0
        end=N-1
        while end-start>1:
            test=(end+start)//2
            if 0>A[test]:
                start=test
            else:
                end=test
        if 0>A[end]:
            mid=end
        else:
            mid=start
        M=sum(abs(A[i]) for i in range(0,N))
        print(M)
        s=A[0]
        for i in range(mid+1,N):
            if i!=N-1:
                print(s,A[i])
                s-=A[i]
            else:
                print(A[N-1],s)
                s=A[N-1]-s
        for i in range(1,mid+1):
            print(s,A[i])
            s-=A[i]
    else:
        M=-sum(A)+2*A[N-1]
        print(M)
        s=A[N-1]
        for i in range(0,N-1):
            print(s,A[i])
            s-=A[i] 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 m=A[0] m A[0] A 0 if m>=0:
    M=sum(A)-2*m
    print(M)
    s=A[0]
    for i in range(0,N-1):
        if i!=N-2:
            print(s,A[i+1])
            s-=A[i+1]
        else:
            print(A[N-1],s)
else:
    if A[N-1]>0:
        start=0
        end=N-1
        while end-start>1:
            test=(end+start)//2
            if 0>A[test]:
                start=test
            else:
                end=test
        if 0>A[end]:
            mid=end
        else:
            mid=start
        M=sum(abs(A[i]) for i in range(0,N))
        print(M)
        s=A[0]
        for i in range(mid+1,N):
            if i!=N-1:
                print(s,A[i])
                s-=A[i]
            else:
                print(A[N-1],s)
                s=A[N-1]-s
        for i in range(1,mid+1):
            print(s,A[i])
            s-=A[i]
    else:
        M=-sum(A)+2*A[N-1]
        print(M)
        s=A[N-1]
        for i in range(0,N-1):
            print(s,A[i])
            s-=A[i] m>=0 m 0 M=sum(A)-2*m M sum(A)-2*m sum(A) sum A 2*m 2 m print(M) print M s=A[0] s A[0] A 0 for i in range(0,N-1):
        if i!=N-2:
            print(s,A[i+1])
            s-=A[i+1]
        else:
            print(A[N-1],s) i range(0,N-1) range 0 N-1 N 1 if i!=N-2:
            print(s,A[i+1])
            s-=A[i+1]
        else:
            print(A[N-1],s) i!=N-2 i N-2 N 2 print(s,A[i+1]) print s A[i+1] A i+1 i 1 s-=A[i+1] s A[i+1] A i+1 i 1 print(A[N-1],s) print A[N-1] A N-1 N 1 s if A[N-1]>0:
        start=0
        end=N-1
        while end-start>1:
            test=(end+start)//2
            if 0>A[test]:
                start=test
            else:
                end=test
        if 0>A[end]:
            mid=end
        else:
            mid=start
        M=sum(abs(A[i]) for i in range(0,N))
        print(M)
        s=A[0]
        for i in range(mid+1,N):
            if i!=N-1:
                print(s,A[i])
                s-=A[i]
            else:
                print(A[N-1],s)
                s=A[N-1]-s
        for i in range(1,mid+1):
            print(s,A[i])
            s-=A[i]
    else:
        M=-sum(A)+2*A[N-1]
        print(M)
        s=A[N-1]
        for i in range(0,N-1):
            print(s,A[i])
            s-=A[i] A[N-1]>0 A[N-1] A N-1 N 1 0 start=0 start 0 end=N-1 end N-1 N 1 while end-start>1:
            test=(end+start)//2
            if 0>A[test]:
                start=test
            else:
                end=test
         end-start>1 end-start end start 1 test=(end+start)//2 test (end+start)//2 end+start end start 2 if 0>A[test]:
                start=test
            else:
                end=test
         0>A[test] 0 A[test] A test start=test start test end=test end test if 0>A[end]:
            mid=end
        else:
            mid=start
         0>A[end] 0 A[end] A end mid=end mid end mid=start mid start M=sum(abs(A[i]) for i in range(0,N)) M sum(abs(A[i]) for i in range(0,N)) sum abs(A[i]) abs A[i] A i print(M) print M s=A[0] s A[0] A 0 for i in range(mid+1,N):
            if i!=N-1:
                print(s,A[i])
                s-=A[i]
            else:
                print(A[N-1],s)
                s=A[N-1]-s
         i range(mid+1,N) range mid+1 mid 1 N if i!=N-1:
                print(s,A[i])
                s-=A[i]
            else:
                print(A[N-1],s)
                s=A[N-1]-s
         i!=N-1 i N-1 N 1 print(s,A[i]) print s A[i] A i s-=A[i] s A[i] A i print(A[N-1],s) print A[N-1] A N-1 N 1 s s=A[N-1]-s s A[N-1]-s A[N-1] A N-1 N 1 s for i in range(1,mid+1):
            print(s,A[i])
            s-=A[i]
     i range(1,mid+1) range 1 mid+1 mid 1 print(s,A[i]) print s A[i] A i s-=A[i] s A[i] A i M=-sum(A)+2*A[N-1] M -sum(A)+2*A[N-1] -sum(A) sum(A) sum A 2*A[N-1] 2 A[N-1] A N-1 N 1 print(M) print M s=A[N-1] s A[N-1] A N-1 N 1 for i in range(0,N-1):
            print(s,A[i])
            s-=A[i] i range(0,N-1) range 0 N-1 N 1 print(s,A[i]) print s A[i] A i s-=A[i] s A[i] A i end=N-1 N-1 end A=list(map(int,input().split())) list(map(int,input().split())) A mid=end end mid s=A[N-1] A[N-1] s s-=A[i+1] A[i+1] s s-=A[i] A[i] s s=A[N-1]-s A[N-1]-s s test=(end+start)//2 (end+start)//2 test M=sum(A)-2*m sum(A)-2*m M s=A[0] A[0] s start=0 0 start s=A[0] A[0] s s-=A[i] A[i] s N=int(input()) int(input()) N end=test test end start=test test start s-=A[i] A[i] s m=A[0] A[0] m mid=start start mid M=-sum(A)+2*A[N-1] -sum(A)+2*A[N-1] M M=sum(abs(A[i]) for i in range(0,N)) sum(abs(A[i]) for i in range(0,N)) M
N=int(input())
A=list(map(int,input().split()))
A.sort()
m=A[0]
if m>=0:
    M=sum(A)-2*m
    print(M)
    s=A[0]
    for i in range(0,N-1):
        if i!=N-2:
            print(s,A[i+1])
            s-=A[i+1]
        else:
            print(A[N-1],s)
else:
    if A[N-1]>0:
        start=0
        end=N-1
        while end-start>1:
            test=(end+start)//2
            if 0>A[test]:
                start=test
            else:
                end=test
        if 0>A[end]:
            mid=end
        else:
            mid=start
        M=sum(abs(A[i]) for i in range(0,N))
        print(M)
        s=A[0]
        for i in range(mid+1,N):
            if i!=N-1:
                print(s,A[i])
                s-=A[i]
            else:
                print(A[N-1],s)
                s=A[N-1]-s
        for i in range(1,mid+1):
            print(s,A[i])
            s-=A[i]
    else:
        M=-sum(A)+2*A[N-1]
        print(M)
        s=A[N-1]
        for i in range(0,N-1):
            print(s,A[i])
            s-=A[i]
