import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; cnt = 0; ansli = []; tmpli = []; candili = []; stillset = set()
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def s_list(): return list(input())
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def grid(n): return [s_list() for _ in range(n)]

n = i()
a = wi()

minus = 0
plus = 0

a.sort()
for i in range(n):
    if a[i] >= 0:
        plus += 1
    elif a[i] < 0:
        minus += 1

if plus == 0:
    minus -= 1
    plus += 1
elif plus == n:
    minus += 1
    plus -= 1


mli = []
pli = []
for i in range(1, n + 1):
    if i <= minus:
        ans += -a[i - 1]
        mli.append(a[i - 1])
    else:
        ans += a[i - 1]
        pli.append(a[i - 1])

print(ans)
for i in range(n - 1):
    if i == 0:
        if plus == 1:
            print(pli[0], mli[0])
            tmp = pli[0] - mli[0]
        else:
            print(mli[0], pli[0])
            tmp = mli[0] - pli[0]
    elif i < plus - 1:
        print(tmp, pli[i])
        tmp = tmp - pli[i]
    elif i == plus - 1:
        print(pli[i], tmp)
        tmp = pli[i] - tmp
    else:
        print(tmp, mli[i - plus + 1])
        tmp = tmp - mli[i - plus + 1] import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random math string itertools fractions heapq collections re array bisect copy functools random import sys sys from collections import deque, defaultdict, Counter from heapq import heappush, heappop from itertools import permutations, combinations, product, accumulate, groupby from bisect import bisect_left, bisect_right, insort_left, insort_right from operator import itemgetter as ig sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 inf = 10 ** 20 inf 10 ** 20 10 20 INF = float("INF") INF float("INF") float "INF" ans = 0 ans 0 tmp = 0 tmp 0 cnt = 0 cnt 0 ansli = [] ansli [] tmpli = [] tmpli [] candili = [] candili [] stillset = set() stillset set() set eps = 1.0 / 10 ** 10 eps 1.0 / 10 ** 10 1.0 10 ** 10 10 10 mod = 10 ** 9 + 7 mod 10 ** 9 + 7 10 ** 9 10 9 7 dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] dd [(-1, 0), (0, 1), (1, 0), (0, -1)] (-1, 0) -1 0 (0, 1) 0 1 (1, 0) 1 0 (0, -1) 0 -1 ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)] ddn dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)] dd [(-1, 1), (1, 1), (1, -1), (-1, -1)] (-1, 1) -1 1 (1, 1) 1 1 (1, -1) 1 -1 (-1, -1) -1 -1 ddn9 = ddn + [(0, 0)] ddn9 ddn + [(0, 0)] ddn [(0, 0)] (0, 0) 0 0 """for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:""" def wi(): return list(map(int, sys.stdin.readline().split())) wi int(x) - 1 for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() int(x) - 1 int(x) int x 1 def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint wip def ws(): return sys.stdin.readline().split() ws def i(): return int(sys.stdin.readline()) i def s(): return input() s def s_list(): return list(input()) s_list i() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) i() i def hi(n): return [i() for _ in range(n)] hi n n s() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) s() s def hs(n): return [s() for _ in range(n)]#HeightString hs n n wi() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) wi() wi def mi(n): return [wi() for _ in range(n)]#MatrixInt mi n n [int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) [int(i) for i in sys.stdin.readline().split()[0]] def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid num_grid n n wip() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) wip() wip def mip(n): return [wip() for _ in range(n)] mip n n ws() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) ws() ws def ms(n): return [ws() for _ in range(n)] ms n n s_list() for _ in range(n) for _ in range(n) _ range(n) range n for _ in range(n) s_list() s_list def grid(n): return [s_list() for _ in range(n)] grid n n n = i() n i() i a = wi() a wi() wi minus = 0 minus 0 plus = 0 plus 0 a.sort() a.sort a sort for i in range(n):
    if a[i] >= 0:
        plus += 1
    elif a[i] < 0:
        minus += 1 i range(n) range n if a[i] >= 0:
        plus += 1
    elif a[i] < 0:
        minus += 1 a[i] >= 0 a[i] a i 0 plus += 1 plus 1 elif a[i] < 0:
        minus += 1 a[i] < 0 a[i] a i 0 minus += 1 minus 1 if plus == 0:
    minus -= 1
    plus += 1
elif plus == n:
    minus += 1
    plus -= 1 plus == 0 plus 0 minus -= 1 minus 1 plus += 1 plus 1 elif plus == n:
    minus += 1
    plus -= 1 plus == n plus n minus += 1 minus 1 plus -= 1 plus 1 mli = [] mli [] pli = [] pli [] for i in range(1, n + 1):
    if i <= minus:
        ans += -a[i - 1]
        mli.append(a[i - 1])
    else:
        ans += a[i - 1]
        pli.append(a[i - 1]) i range(1, n + 1) range 1 n + 1 n 1 if i <= minus:
        ans += -a[i - 1]
        mli.append(a[i - 1])
    else:
        ans += a[i - 1]
        pli.append(a[i - 1]) i <= minus i minus ans += -a[i - 1] ans -a[i - 1] a[i - 1] a i - 1 i 1 mli.append(a[i - 1]) mli.append mli append a[i - 1] a i - 1 i 1 ans += a[i - 1] ans a[i - 1] a i - 1 i 1 pli.append(a[i - 1]) pli.append pli append a[i - 1] a i - 1 i 1 print(ans) print ans for i in range(n - 1):
    if i == 0:
        if plus == 1:
            print(pli[0], mli[0])
            tmp = pli[0] - mli[0]
        else:
            print(mli[0], pli[0])
            tmp = mli[0] - pli[0]
    elif i < plus - 1:
        print(tmp, pli[i])
        tmp = tmp - pli[i]
    elif i == plus - 1:
        print(pli[i], tmp)
        tmp = pli[i] - tmp
    else:
        print(tmp, mli[i - plus + 1])
        tmp = tmp - mli[i - plus + 1] i range(n - 1) range n - 1 n 1 if i == 0:
        if plus == 1:
            print(pli[0], mli[0])
            tmp = pli[0] - mli[0]
        else:
            print(mli[0], pli[0])
            tmp = mli[0] - pli[0]
    elif i < plus - 1:
        print(tmp, pli[i])
        tmp = tmp - pli[i]
    elif i == plus - 1:
        print(pli[i], tmp)
        tmp = pli[i] - tmp
    else:
        print(tmp, mli[i - plus + 1])
        tmp = tmp - mli[i - plus + 1] i == 0 i 0 if plus == 1:
            print(pli[0], mli[0])
            tmp = pli[0] - mli[0]
        else:
            print(mli[0], pli[0])
            tmp = mli[0] - pli[0]
     plus == 1 plus 1 print(pli[0], mli[0]) print pli[0] pli 0 mli[0] mli 0 tmp = pli[0] - mli[0] tmp pli[0] - mli[0] pli[0] pli 0 mli[0] mli 0 print(mli[0], pli[0]) print mli[0] mli 0 pli[0] pli 0 tmp = mli[0] - pli[0] tmp mli[0] - pli[0] mli[0] mli 0 pli[0] pli 0 elif i < plus - 1:
        print(tmp, pli[i])
        tmp = tmp - pli[i]
     i < plus - 1 i plus - 1 plus 1 print(tmp, pli[i]) print tmp pli[i] pli i tmp = tmp - pli[i] tmp tmp - pli[i] tmp pli[i] pli i elif i == plus - 1:
        print(pli[i], tmp)
        tmp = pli[i] - tmp
     i == plus - 1 i plus - 1 plus 1 print(pli[i], tmp) print pli[i] pli i tmp tmp = pli[i] - tmp tmp pli[i] - tmp pli[i] pli i tmp print(tmp, mli[i - plus + 1]) print tmp mli[i - plus + 1] mli i - plus + 1 i - plus i plus 1 tmp = tmp - mli[i - plus + 1] tmp tmp - mli[i - plus + 1] tmp mli[i - plus + 1] mli i - plus + 1 i - plus i plus 1 minus += 1 1 minus n = i() i() n INF = float("INF") float("INF") INF ans += a[i - 1] a[i - 1] ans plus = 0 0 plus mli = [] [] mli tmp = 0 0 tmp def hs(n): return [s() for _ in range(n)]#HeightString def hs(n): return [s() for _ in range(n)]#HeightString hs minus += 1 1 minus def s(): return input() def s(): return input() s plus += 1 1 plus def mi(n): return [wi() for _ in range(n)]#MatrixInt def mi(n): return [wi() for _ in range(n)]#MatrixInt mi tmp = mli[0] - pli[0] mli[0] - pli[0] tmp def ws(): return sys.stdin.readline().split() def ws(): return sys.stdin.readline().split() ws def mip(n): return [wip() for _ in range(n)] def mip(n): return [wip() for _ in range(n)] mip tmp = pli[0] - mli[0] pli[0] - mli[0] tmp cnt = 0 0 cnt plus -= 1 1 plus def ms(n): return [ws() for _ in range(n)] def ms(n): return [ws() for _ in range(n)] ms ans += -a[i - 1] -a[i - 1] ans def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint wip tmp = tmp - mli[i - plus + 1] tmp - mli[i - plus + 1] tmp def grid(n): return [s_list() for _ in range(n)] def grid(n): return [s_list() for _ in range(n)] grid mod = 10 ** 9 + 7 10 ** 9 + 7 mod tmpli = [] [] tmpli stillset = set() set() stillset def s_list(): return list(input()) def s_list(): return list(input()) s_list def hi(n): return [i() for _ in range(n)] def hi(n): return [i() for _ in range(n)] hi dd = [(-1, 0), (0, 1), (1, 0), (0, -1)] [(-1, 0), (0, 1), (1, 0), (0, -1)] dd def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid num_grid plus += 1 1 plus ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)] dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)] ddn eps = 1.0 / 10 ** 10 1.0 / 10 ** 10 eps tmp = tmp - pli[i] tmp - pli[i] tmp inf = 10 ** 20 10 ** 20 inf minus -= 1 1 minus candili = [] [] candili ddn9 = ddn + [(0, 0)] ddn + [(0, 0)] ddn9 pli = [] [] pli a = wi() wi() a def wi(): return list(map(int, sys.stdin.readline().split())) def wi(): return list(map(int, sys.stdin.readline().split())) wi minus = 0 0 minus def i(): return int(sys.stdin.readline()) def i(): return int(sys.stdin.readline()) i tmp = pli[i] - tmp pli[i] - tmp tmp ansli = [] [] ansli ans = 0 0 ans
import math, string, itertools, fractions, heapq, collections, re, array, bisect, copy, functools, random
import sys
from collections import deque, defaultdict, Counter; from heapq import heappush, heappop
from itertools import permutations, combinations, product, accumulate, groupby
from bisect import bisect_left, bisect_right, insort_left, insort_right
from operator import itemgetter as ig
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20; INF = float("INF"); ans = 0; tmp = 0; cnt = 0; ansli = []; tmpli = []; candili = []; stillset = set()
eps = 1.0 / 10 ** 10; mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]; ddn = dd + [(-1, 1), (1, 1), (1, -1), (-1, -1)]; ddn9 = ddn + [(0, 0)]
"""for dx, dy in dd:
        nx = j + dx; ny = i + dy
            if 0 <= nx < w and 0 <= ny < h:"""
def wi(): return list(map(int, sys.stdin.readline().split()))
def wip(): return [int(x) - 1 for x in sys.stdin.readline().split()]#WideIntPoint
def ws(): return sys.stdin.readline().split()
def i(): return int(sys.stdin.readline())
def s(): return input()
def s_list(): return list(input())
def hi(n): return [i() for _ in range(n)]
def hs(n): return [s() for _ in range(n)]#HeightString
def mi(n): return [wi() for _ in range(n)]#MatrixInt
def num_grid(n): return [[int(i) for i in sys.stdin.readline().split()[0]] for _ in range(n)]#NumberGrid
def mip(n): return [wip() for _ in range(n)]
def ms(n): return [ws() for _ in range(n)]
def grid(n): return [s_list() for _ in range(n)]

n = i()
a = wi()

minus = 0
plus = 0

a.sort()
for i in range(n):
    if a[i] >= 0:
        plus += 1
    elif a[i] < 0:
        minus += 1

if plus == 0:
    minus -= 1
    plus += 1
elif plus == n:
    minus += 1
    plus -= 1


mli = []
pli = []
for i in range(1, n + 1):
    if i <= minus:
        ans += -a[i - 1]
        mli.append(a[i - 1])
    else:
        ans += a[i - 1]
        pli.append(a[i - 1])

print(ans)
for i in range(n - 1):
    if i == 0:
        if plus == 1:
            print(pli[0], mli[0])
            tmp = pli[0] - mli[0]
        else:
            print(mli[0], pli[0])
            tmp = mli[0] - pli[0]
    elif i < plus - 1:
        print(tmp, pli[i])
        tmp = tmp - pli[i]
    elif i == plus - 1:
        print(pli[i], tmp)
        tmp = pli[i] - tmp
    else:
        print(tmp, mli[i - plus + 1])
        tmp = tmp - mli[i - plus + 1]