from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n = II()
a = sorted(LI(), reverse=True)
ans = []
s = 0
if all([i < 0 for i in a]):
    tmp = a[0]
    for i in range(1, n):
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1])
else:
    tmp = a[-1]
    for i in range(1, n - 1):
        if a[i] < 0:
            break
        ans.append((tmp, a[i]))
        tmp -= a[i]

    ans.append((max(a), tmp))
    tmp = max(a) - tmp

    for i in range(1, n - 1):
        if a[i] >= 0:
            continue
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1]) from collections import Counter from collections import deque from functools import reduce from pprint import pprint import bisect bisect import copy copy import fractions fractions import itertools itertools import math math import queue queue import random random import sys sys import time time sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 INF = 10 ** 18 INF 10 ** 18 10 18 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 int(x) 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) int x def LI(): return [int(x) for x in sys.stdin.readline().split()] LI float(x) 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() float(x) float x def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() LS def MI(): return map(int, sys.stdin.readline().split()) MI def II(): return int(sys.stdin.readline()) II def IS(): return input() IS def C(x): return Counter(x) C x x def GCD_LIST(numbers): return reduce(fractions.gcd, numbers) GCD_LIST numbers numbers def LCM_LIST(numbers): return reduce(LCM, numbers) LCM_LIST numbers numbers def LCM(m, n): return (m * n // fractions.gcd(m, n)) LCM m m n n n = II() n II() II a = sorted(LI(), reverse=True) a sorted(LI(), reverse=True) sorted LI() LI reverse=True reverse True ans = [] ans [] s = 0 s 0 if all([i < 0 for i in a]):
    tmp = a[0]
    for i in range(1, n):
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1])
else:
    tmp = a[-1]
    for i in range(1, n - 1):
        if a[i] < 0:
            break
        ans.append((tmp, a[i]))
        tmp -= a[i]

    ans.append((max(a), tmp))
    tmp = max(a) - tmp

    for i in range(1, n - 1):
        if a[i] >= 0:
            continue
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1]) all([i < 0 for i in a]) all [i < 0 for i in a] tmp = a[0] tmp a[0] a 0 for i in range(1, n):
        ans.append((tmp, a[i]))
        tmp -= a[i]
     i range(1, n) range 1 n ans.append((tmp, a[i])) ans.append ans append (tmp, a[i]) tmp a[i] a i tmp -= a[i] tmp a[i] a i print(tmp) print tmp for i in ans:
        print(i[0], i[1]) i ans print(i[0], i[1]) print i[0] i 0 i[1] i 1 tmp = a[-1] tmp a[-1] a -1 for i in range(1, n - 1):
        if a[i] < 0:
            break
        ans.append((tmp, a[i]))
        tmp -= a[i]

     i range(1, n - 1) range 1 n - 1 n 1 if a[i] < 0:
            break
         a[i] < 0 a[i] a i 0 break ans.append((tmp, a[i])) ans.append ans append (tmp, a[i]) tmp a[i] a i tmp -= a[i] tmp a[i] a i ans.append((max(a), tmp)) ans.append ans append (max(a), tmp) max(a) max a tmp tmp = max(a) - tmp tmp max(a) - tmp max(a) max a tmp for i in range(1, n - 1):
        if a[i] >= 0:
            continue
        ans.append((tmp, a[i]))
        tmp -= a[i]
     i range(1, n - 1) range 1 n - 1 n 1 if a[i] >= 0:
            continue
         a[i] >= 0 a[i] a i 0 continue ans.append((tmp, a[i])) ans.append ans append (tmp, a[i]) tmp a[i] a i tmp -= a[i] tmp a[i] a i print(tmp) print tmp for i in ans:
        print(i[0], i[1]) i ans print(i[0], i[1]) print i[0] i 0 i[1] i 1 a = sorted(LI(), reverse=True) sorted(LI(), reverse=True) a tmp = a[0] a[0] tmp tmp = max(a) - tmp max(a) - tmp tmp tmp = a[-1] a[-1] tmp tmp -= a[i] a[i] tmp def MI(): return map(int, sys.stdin.readline().split()) def MI(): return map(int, sys.stdin.readline().split()) MI tmp -= a[i] a[i] tmp ans = [] [] ans def LF(): return [float(x) for x in sys.stdin.readline().split()] def LF(): return [float(x) for x in sys.stdin.readline().split()] LF def LS(): return sys.stdin.readline().split() def LS(): return sys.stdin.readline().split() LS def II(): return int(sys.stdin.readline()) def II(): return int(sys.stdin.readline()) II def LCM(m, n): return (m * n // fractions.gcd(m, n)) def LCM(m, n): return (m * n // fractions.gcd(m, n)) LCM INF = 10 ** 18 10 ** 18 INF tmp -= a[i] a[i] tmp def IS(): return input() def IS(): return input() IS n = II() II() n s = 0 0 s MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD def C(x): return Counter(x) def C(x): return Counter(x) C def LI(): return [int(x) for x in sys.stdin.readline().split()] def LI(): return [int(x) for x in sys.stdin.readline().split()] LI def GCD_LIST(numbers): return reduce(fractions.gcd, numbers) def GCD_LIST(numbers): return reduce(fractions.gcd, numbers) GCD_LIST def LCM_LIST(numbers): return reduce(LCM, numbers) def LCM_LIST(numbers): return reduce(LCM, numbers) LCM_LIST
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))


n = II()
a = sorted(LI(), reverse=True)
ans = []
s = 0
if all([i < 0 for i in a]):
    tmp = a[0]
    for i in range(1, n):
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1])
else:
    tmp = a[-1]
    for i in range(1, n - 1):
        if a[i] < 0:
            break
        ans.append((tmp, a[i]))
        tmp -= a[i]

    ans.append((max(a), tmp))
    tmp = max(a) - tmp

    for i in range(1, n - 1):
        if a[i] >= 0:
            continue
        ans.append((tmp, a[i]))
        tmp -= a[i]
    print(tmp)
    for i in ans:
        print(i[0], i[1])
