import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
lis2=sorted(lis)
pm=[-1 for i in range(n)]
for i in range(n):
    if lis2[i]>=0:
        pm[i]=1
if pm[0]==1:
    pm[0]=-1
elif pm[-1]==-1:
    pm[-1]=1
ans=0
for i in range(n):
    ans=ans+pm[i]*lis2[i]
print(ans)
x=lis2[0]
for i in range(1,n-1):
    if pm[i]==1:
        print(x,lis2[i])
        x=x-lis2[i]
for i in range(1,n-1):
    if pm[i]==-1:
        print(lis2[-1],lis2[i])
        lis2[-1]=lis2[-1]-lis2[i]
print(lis2[-1],x)
    
        


            
        
        
            
    
            
            

    
    
            
            
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush from math import floor, ceil,pi,factorial from operator import itemgetter def I(): return int(input()) I def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) LI int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input def LI2(): return [int(input()) for i in range(n)] LI2 [LI()]for i in range(n) for i in range(n) i range(n) range n for i in range(n) [LI()] LI() LI def MXI(): return [[LI()]for i in range(n)] MXI def SI(): return input().rstrip() SI def printns(x): print('\n'.join(x)) printns x x def printni(x): print('\n'.join(list(map(str,x)))) printni x x inf = 10**17 inf 10**17 10 17 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 n=I() n I() I lis=LI() lis LI() LI lis2=sorted(lis) lis2 sorted(lis) sorted lis -1 for i in range(n) for i in range(n) i range(n) range n for i in range(n) -1 pm=[-1 for i in range(n)] pm [-1 for i in range(n)] for i in range(n):
    if lis2[i]>=0:
        pm[i]=1 i range(n) range n if lis2[i]>=0:
        pm[i]=1 lis2[i]>=0 lis2[i] lis2 i 0 pm[i]=1 pm[i] pm i 1 if pm[0]==1:
    pm[0]=-1
elif pm[-1]==-1:
    pm[-1]=1 pm[0]==1 pm[0] pm 0 1 pm[0]=-1 pm[0] pm 0 -1 elif pm[-1]==-1:
    pm[-1]=1 pm[-1]==-1 pm[-1] pm -1 -1 pm[-1]=1 pm[-1] pm -1 1 ans=0 ans 0 for i in range(n):
    ans=ans+pm[i]*lis2[i] i range(n) range n ans=ans+pm[i]*lis2[i] ans ans+pm[i]*lis2[i] ans pm[i]*lis2[i] pm[i] pm i lis2[i] lis2 i print(ans) print ans x=lis2[0] x lis2[0] lis2 0 for i in range(1,n-1):
    if pm[i]==1:
        print(x,lis2[i])
        x=x-lis2[i] i range(1,n-1) range 1 n-1 n 1 if pm[i]==1:
        print(x,lis2[i])
        x=x-lis2[i] pm[i]==1 pm[i] pm i 1 print(x,lis2[i]) print x lis2[i] lis2 i x=x-lis2[i] x x-lis2[i] x lis2[i] lis2 i for i in range(1,n-1):
    if pm[i]==-1:
        print(lis2[-1],lis2[i])
        lis2[-1]=lis2[-1]-lis2[i] i range(1,n-1) range 1 n-1 n 1 if pm[i]==-1:
        print(lis2[-1],lis2[i])
        lis2[-1]=lis2[-1]-lis2[i] pm[i]==-1 pm[i] pm i -1 print(lis2[-1],lis2[i]) print lis2[-1] lis2 -1 lis2[i] lis2 i lis2[-1]=lis2[-1]-lis2[i] lis2[-1] lis2 -1 lis2[-1]-lis2[i] lis2[-1] lis2 -1 lis2[i] lis2 i print(lis2[-1],x) print lis2[-1] lis2 -1 x inf = 10**17 10**17 inf def SI(): return input().rstrip() def SI(): return input().rstrip() SI def MXI(): return [[LI()]for i in range(n)] def MXI(): return [[LI()]for i in range(n)] MXI def printni(x): print('\n'.join(list(map(str,x)))) def printni(x): print('\n'.join(list(map(str,x)))) printni def I(): return int(input()) def I(): return int(input()) I def printns(x): print('\n'.join(x)) def printns(x): print('\n'.join(x)) printns ans=0 0 ans x=x-lis2[i] x-lis2[i] x pm=[-1 for i in range(n)] [-1 for i in range(n)] pm x=lis2[0] lis2[0] x n=I() I() n def LI2(): return [int(input()) for i in range(n)] def LI2(): return [int(input()) for i in range(n)] LI2 def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI input = sys.stdin.readline sys.stdin.readline input ans=ans+pm[i]*lis2[i] ans+pm[i]*lis2[i] ans lis=LI() LI() lis lis2=sorted(lis) sorted(lis) lis2 def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI mod = 10**9 + 7 10**9 + 7 mod
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
lis2=sorted(lis)
pm=[-1 for i in range(n)]
for i in range(n):
    if lis2[i]>=0:
        pm[i]=1
if pm[0]==1:
    pm[0]=-1
elif pm[-1]==-1:
    pm[-1]=1
ans=0
for i in range(n):
    ans=ans+pm[i]*lis2[i]
print(ans)
x=lis2[0]
for i in range(1,n-1):
    if pm[i]==1:
        print(x,lis2[i])
        x=x-lis2[i]
for i in range(1,n-1):
    if pm[i]==-1:
        print(lis2[-1],lis2[i])
        lis2[-1]=lis2[-1]-lis2[i]
print(lis2[-1],x)
    
        


            
        
        
            
    
            
            

    
    
            
            

