import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

n=int(input())
a=list(map(int,input().split()))
a.sort()

lst=[]

flag=0
for i in range(n-1):
    if a[i+1]>0:
        flag=i+1
        break
if flag==0:
    flag=n-1
tmp=a[0]
for i in range(flag,n-1):
    lst.append([tmp,a[i]])
    tmp-=a[i]
a[0]=tmp
tmp=a[-1]
for i in range(flag):
    lst.append([tmp,a[i]])
    tmp-=a[i]

print(tmp)
for i in range(n-1):
    print(*lst[i])
    
# print(lst) import sys sys from collections import * import heapq heapq import math math import bisect bisect from itertools import permutations,accumulate,combinations,product from fractions import gcd def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 mod=10**9+7 mod 10**9+7 10**9 10 9 7 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 lst=[] lst [] flag=0 flag 0 for i in range(n-1):
    if a[i+1]>0:
        flag=i+1
        break i range(n-1) range n-1 n 1 if a[i+1]>0:
        flag=i+1
        break a[i+1]>0 a[i+1] a i+1 i 1 0 flag=i+1 flag i+1 i 1 break if flag==0:
    flag=n-1 flag==0 flag 0 flag=n-1 flag n-1 n 1 tmp=a[0] tmp a[0] a 0 for i in range(flag,n-1):
    lst.append([tmp,a[i]])
    tmp-=a[i] i range(flag,n-1) range flag n-1 n 1 lst.append([tmp,a[i]]) lst.append lst append [tmp,a[i]] tmp a[i] a i tmp-=a[i] tmp a[i] a i a[0]=tmp a[0] a 0 tmp tmp=a[-1] tmp a[-1] a -1 for i in range(flag):
    lst.append([tmp,a[i]])
    tmp-=a[i] i range(flag) range flag lst.append([tmp,a[i]]) lst.append lst append [tmp,a[i]] tmp a[i] a i tmp-=a[i] tmp a[i] a i print(tmp) print tmp for i in range(n-1):
    print(*lst[i])
    
# print(lst) i range(n-1) range n-1 n 1 print(*lst[i]) print *lst[i] lst[i] lst i a=list(map(int,input().split())) list(map(int,input().split())) a flag=n-1 n-1 flag tmp=a[-1] a[-1] tmp mod=10**9+7 10**9+7 mod flag=i+1 i+1 flag tmp=a[0] a[0] tmp def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input flag=0 0 flag tmp-=a[i] a[i] tmp n=int(input()) int(input()) n lst=[] [] lst tmp-=a[i] a[i] tmp
import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations,accumulate,combinations,product
from fractions import gcd
def input():
    return sys.stdin.readline()[:-1]
mod=10**9+7

n=int(input())
a=list(map(int,input().split()))
a.sort()

lst=[]

flag=0
for i in range(n-1):
    if a[i+1]>0:
        flag=i+1
        break
if flag==0:
    flag=n-1
tmp=a[0]
for i in range(flag,n-1):
    lst.append([tmp,a[i]])
    tmp-=a[i]
a[0]=tmp
tmp=a[-1]
for i in range(flag):
    lst.append([tmp,a[i]])
    tmp-=a[i]

print(tmp)
for i in range(n-1):
    print(*lst[i])
    
# print(lst)