# coding: utf-8
import sys

# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
printout = sys.stdout.write
sprint = sys.stdout.flush
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
#import math
# from itertools import product, accumulate, combinations, product
import bisect
# import numpy as np
# from copy import deepcopy
#from collections import deque
# from decimal import Decimal
# from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 998244353


def intread():
    return int(sysread())
def mapline(t=int):
    return map(t, sysread().split())
def mapread(t=int):
    return map(t, read().split())


def run():
    N, *A = mapread()
    A.sort()
    i = bisect.bisect_right(A, -EPS)
    cache = []
    if i <= N-1:
        if i < 1:
            i = 1
        ans = A[i-1]
        for k in range(i, N-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        cache.append((A[N-1], ans))
        ans = A[N-1] - ans
        for k in range(0, i-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')
    elif i > N-1:
        ans = A[-1]
        for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')


if __name__ == "__main__":
    #print(math.gcd(0, 10))
    run() import sys sys sysread = sys.stdin.buffer.readline sysread sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read printout = sys.stdout.write printout sys.stdout.write sys.stdout sys stdout write sprint = sys.stdout.flush sprint sys.stdout.flush sys.stdout sys stdout flush sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 import bisect bisect INF = 1 << 50 INF 1 << 50 1 50 EPS = 1e-8 EPS 1e-8 mod = 998244353 mod 998244353 def intread():
    return int(sysread()) intread return int(sysread()) int(sysread()) int sysread() sysread def mapline(t=int):
    return map(t, sysread().split()) mapline return map(t, sysread().split()) map(t, sysread().split()) map t sysread().split() ().split () sysread split t=int t int def mapread(t=int):
    return map(t, read().split()) mapread return map(t, read().split()) map(t, read().split()) map t read().split() ().split () read split t=int t int def run():
    N, *A = mapread()
    A.sort()
    i = bisect.bisect_right(A, -EPS)
    cache = []
    if i <= N-1:
        if i < 1:
            i = 1
        ans = A[i-1]
        for k in range(i, N-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        cache.append((A[N-1], ans))
        ans = A[N-1] - ans
        for k in range(0, i-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')
    elif i > N-1:
        ans = A[-1]
        for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}') run N, *A = mapread() N mapread() mapread *A A A.sort() A.sort A sort i = bisect.bisect_right(A, -EPS) i bisect.bisect_right(A, -EPS) bisect.bisect_right bisect bisect_right A -EPS EPS cache = [] cache [] if i <= N-1:
        if i < 1:
            i = 1
        ans = A[i-1]
        for k in range(i, N-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        cache.append((A[N-1], ans))
        ans = A[N-1] - ans
        for k in range(0, i-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')
    elif i > N-1:
        ans = A[-1]
        for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}') i <= N-1 i N-1 N 1 if i < 1:
            i = 1
         i < 1 i 1 i = 1 i 1 ans = A[i-1] ans A[i-1] A i-1 i 1 for k in range(i, N-1):
            cache.append((ans, A[k]))
            ans -= A[k]
         k range(i, N-1) range i N-1 N 1 cache.append((ans, A[k])) cache.append cache append (ans, A[k]) ans A[k] A k ans -= A[k] ans A[k] A k cache.append((A[N-1], ans)) cache.append cache append (A[N-1], ans) A[N-1] A N-1 N 1 ans ans = A[N-1] - ans ans A[N-1] - ans A[N-1] A N-1 N 1 ans for k in range(0, i-1):
            cache.append((ans, A[k]))
            ans -= A[k]
         k range(0, i-1) range 0 i-1 i 1 cache.append((ans, A[k])) cache.append cache append (ans, A[k]) ans A[k] A k ans -= A[k] ans A[k] A k print(ans) print ans for x, y in cache:
            print(f'{x} {y}')
     x y cache print(f'{x} {y}') print f'{x} {y}' elif i > N-1:
        ans = A[-1]
        for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}') i > N-1 i N-1 N 1 ans = A[-1] ans A[-1] A -1 for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
         i range(N-1) range N-1 N 1 cache.append((ans, A[i])) cache.append cache append (ans, A[i]) ans A[i] A i ans -= A[i] ans A[i] A i print(ans) print ans for x, y in cache:
            print(f'{x} {y}') x y cache print(f'{x} {y}') print f'{x} {y}' if __name__ == "__main__":
    #print(math.gcd(0, 10))
    run() __name__ == "__main__" __name__ "__main__" run() run read = sys.stdin.buffer.read sys.stdin.buffer.read read def run():
    N, *A = mapread()
    A.sort()
    i = bisect.bisect_right(A, -EPS)
    cache = []
    if i <= N-1:
        if i < 1:
            i = 1
        ans = A[i-1]
        for k in range(i, N-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        cache.append((A[N-1], ans))
        ans = A[N-1] - ans
        for k in range(0, i-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')
    elif i > N-1:
        ans = A[-1]
        for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}') def run():
    N, *A = mapread()
    A.sort()
    i = bisect.bisect_right(A, -EPS)
    cache = []
    if i <= N-1:
        if i < 1:
            i = 1
        ans = A[i-1]
        for k in range(i, N-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        cache.append((A[N-1], ans))
        ans = A[N-1] - ans
        for k in range(0, i-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')
    elif i > N-1:
        ans = A[-1]
        for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}') run sysread = sys.stdin.buffer.readline sys.stdin.buffer.readline sysread def mapread(t=int):
    return map(t, read().split()) def mapread(t=int):
    return map(t, read().split()) mapread printout = sys.stdout.write sys.stdout.write printout def mapline(t=int):
    return map(t, sysread().split()) def mapline(t=int):
    return map(t, sysread().split()) mapline sprint = sys.stdout.flush sys.stdout.flush sprint def intread():
    return int(sysread()) def intread():
    return int(sysread()) intread INF = 1 << 50 1 << 50 INF mod = 998244353 998244353 mod EPS = 1e-8 1e-8 EPS
# coding: utf-8
import sys

# from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
printout = sys.stdout.write
sprint = sys.stdout.flush
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
#import math
# from itertools import product, accumulate, combinations, product
import bisect
# import numpy as np
# from copy import deepcopy
#from collections import deque
# from decimal import Decimal
# from numba import jit

INF = 1 << 50
EPS = 1e-8
mod = 998244353


def intread():
    return int(sysread())
def mapline(t=int):
    return map(t, sysread().split())
def mapread(t=int):
    return map(t, read().split())


def run():
    N, *A = mapread()
    A.sort()
    i = bisect.bisect_right(A, -EPS)
    cache = []
    if i <= N-1:
        if i < 1:
            i = 1
        ans = A[i-1]
        for k in range(i, N-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        cache.append((A[N-1], ans))
        ans = A[N-1] - ans
        for k in range(0, i-1):
            cache.append((ans, A[k]))
            ans -= A[k]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')
    elif i > N-1:
        ans = A[-1]
        for i in range(N-1):
            cache.append((ans, A[i]))
            ans -= A[i]
        print(ans)
        for x, y in cache:
            print(f'{x} {y}')


if __name__ == "__main__":
    #print(math.gcd(0, 10))
    run()
