#diverta 2019 Programming Contest 2 -C Successive Subtraction
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))

lst1.sort()
lst2 = []
l,r = lst1[0],lst1[-1]
for i in range(1,n-1):
    mid = lst1[i]
    if mid < 0:
        lst2.append([r,mid])
        r -= mid
    else:
        lst2.append([l,mid])
        l -= mid
lst2.append([r,l])
print(r-l)
for i in lst2:
    print(*i) import sys sys readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline def even(n): return 1 if n%2==0 else 0 even n n n = int(readline()) n int(readline()) int readline() readline lst1 = list(map(int,readline().split())) lst1 list(map(int,readline().split())) list map(int,readline().split()) map int readline().split() ().split () readline split lst1.sort() lst1.sort lst1 sort lst2 = [] lst2 [] l,r = lst1[0],lst1[-1] l lst1[0] lst1 0 r lst1[-1] lst1 -1 for i in range(1,n-1):
    mid = lst1[i]
    if mid < 0:
        lst2.append([r,mid])
        r -= mid
    else:
        lst2.append([l,mid])
        l -= mid i range(1,n-1) range 1 n-1 n 1 mid = lst1[i] mid lst1[i] lst1 i if mid < 0:
        lst2.append([r,mid])
        r -= mid
    else:
        lst2.append([l,mid])
        l -= mid mid < 0 mid 0 lst2.append([r,mid]) lst2.append lst2 append [r,mid] r mid r -= mid r mid lst2.append([l,mid]) lst2.append lst2 append [l,mid] l mid l -= mid l mid lst2.append([r,l]) lst2.append lst2 append [r,l] r l print(r-l) print r-l r l for i in lst2:
    print(*i) i lst2 print(*i) print *i i lst1 = list(map(int,readline().split())) list(map(int,readline().split())) lst1 mid = lst1[i] lst1[i] mid r -= mid mid r l -= mid mid l lst2 = [] [] lst2 def even(n): return 1 if n%2==0 else 0 def even(n): return 1 if n%2==0 else 0 even n = int(readline()) int(readline()) n r = lst1[0],lst1[-1] lst1[-1] r l,r = lst1[0],lst1[-1] lst1[0] l readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline
#diverta 2019 Programming Contest 2 -C Successive Subtraction
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
n = int(readline())
lst1 = list(map(int,readline().split()))

lst1.sort()
lst2 = []
l,r = lst1[0],lst1[-1]
for i in range(1,n-1):
    mid = lst1[i]
    if mid < 0:
        lst2.append([r,mid])
        r -= mid
    else:
        lst2.append([l,mid])
        l -= mid
lst2.append([r,l])
print(r-l)
for i in lst2:
    print(*i)