# coding: utf-8
N=int(input())
A=list(map(int,input().split()))

A.sort()

MIN=A[0]
MAX=A[-1]

if MIN>0:
    print(sum(A)-MIN*2)
elif MAX<0:
    print(-(sum(A)-MAX*2))
else:
    M=0
    for i in range(N):
        M+=abs(A[i])
    print(M)
    

for i in range(1,N-1):
    if A[i]<0:
        print(MAX,A[i])
        MAX-=A[i]
    else:
        print(MIN,A[i])
        MIN-=A[i]

print(MAX,MIN) 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 MIN=A[0] MIN A[0] A 0 MAX=A[-1] MAX A[-1] A -1 if MIN>0:
    print(sum(A)-MIN*2)
elif MAX<0:
    print(-(sum(A)-MAX*2))
else:
    M=0
    for i in range(N):
        M+=abs(A[i])
    print(M)
     MIN>0 MIN 0 print(sum(A)-MIN*2) print sum(A)-MIN*2 sum(A) sum A MIN*2 MIN 2 elif MAX<0:
    print(-(sum(A)-MAX*2)) MAX<0 MAX 0 print(-(sum(A)-MAX*2)) print -(sum(A)-MAX*2) sum(A)-MAX*2 sum(A) sum A MAX*2 MAX 2 M=0 M 0 for i in range(N):
        M+=abs(A[i])
     i range(N) range N M+=abs(A[i]) M abs(A[i]) abs A[i] A i print(M) print M for i in range(1,N-1):
    if A[i]<0:
        print(MAX,A[i])
        MAX-=A[i]
    else:
        print(MIN,A[i])
        MIN-=A[i] i range(1,N-1) range 1 N-1 N 1 if A[i]<0:
        print(MAX,A[i])
        MAX-=A[i]
    else:
        print(MIN,A[i])
        MIN-=A[i] A[i]<0 A[i] A i 0 print(MAX,A[i]) print MAX A[i] A i MAX-=A[i] MAX A[i] A i print(MIN,A[i]) print MIN A[i] A i MIN-=A[i] MIN A[i] A i print(MAX,MIN) print MAX MIN MAX-=A[i] A[i] MAX MIN-=A[i] A[i] MIN M+=abs(A[i]) abs(A[i]) M A=list(map(int,input().split())) list(map(int,input().split())) A MAX=A[-1] A[-1] MAX N=int(input()) int(input()) N MIN=A[0] A[0] MIN M=0 0 M
# coding: utf-8
N=int(input())
A=list(map(int,input().split()))

A.sort()

MIN=A[0]
MAX=A[-1]

if MIN>0:
    print(sum(A)-MIN*2)
elif MAX<0:
    print(-(sum(A)-MAX*2))
else:
    M=0
    for i in range(N):
        M+=abs(A[i])
    print(M)
    

for i in range(1,N-1):
    if A[i]<0:
        print(MAX,A[i])
        MAX-=A[i]
    else:
        print(MIN,A[i])
        MIN-=A[i]

print(MAX,MIN)