import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = [int(v) for v in input().split()]
L.sort()

# only + 2
# only - 1
# + - 3
c = 0
for v in L:
    if v < 0:
        c = c | 1
    elif v > 0:
        c = c | 2

if c == 0:
    c = 2

if c == 2:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    ans = []
    p = L[0] - L[-1]
    ans.append((L[0], L[-1]))
    for v in L[1:-2]:
        ans.append((p, v))
        p -= v
    ans.append((L[-2], p))
    print(L[-2] - p)
    for x, y in ans:
        print(x, y)

if c == 1:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    ans = []
    p = L[-1] - L[0]
    ans.append((L[-1], L[0]))
    for v in L[1:-2]:
        ans.append((p, v))
        p -= v
    ans.append((p, L[-2]))
    print(p - L[-2])
    for x, y in ans:
        print(x, y)

if c == 3:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    mc = 0
    for v in L:
        if v < 0:
            mc += 1

    ans = []
    if N - mc == 1:
        p = L[-1] - L[0]
        ans.append((L[-1], L[0]))
        for v in L[1:-1]:
            ans.append((p, v))
            p -= v
        print(p)
        for x, y in ans:
            print(x, y)

        exit()

    ans = []
    p = L[0] - L[-1]
    ans.append((L[0], L[-1]))
    for v in L[mc:-2]:
        ans.append((p, v))
        p -= v
    ans.append((L[-2], p))
    p = L[-2] - p
    for v in L[1:mc]:
        ans.append((p, v))
        p -= v
    print(p)
    for x, y in ans:
        print(x, y) import sys sys from collections import defaultdict, deque import bisect bisect from heapq import * from math import factorial, ceil, floor from collections import defaultdict sys.setrecursionlimit(200000) sys.setrecursionlimit sys setrecursionlimit 200000 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline N, = map(int, input().split()) N map(int, input().split()) map int input().split() ().split () input split int(v) for v in input().split() for v in input().split() v input().split() ().split () input split for v in input().split() int(v) int v L = [int(v) for v in input().split()] L [int(v) for v in input().split()] L.sort() L.sort L sort c = 0 c 0 for v in L:
    if v < 0:
        c = c | 1
    elif v > 0:
        c = c | 2 v L if v < 0:
        c = c | 1
    elif v > 0:
        c = c | 2 v < 0 v 0 c = c | 1 c c | 1 c 1 elif v > 0:
        c = c | 2 v > 0 v 0 c = c | 2 c c | 2 c 2 if c == 0:
    c = 2 c == 0 c 0 c = 2 c 2 if c == 2:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    ans = []
    p = L[0] - L[-1]
    ans.append((L[0], L[-1]))
    for v in L[1:-2]:
        ans.append((p, v))
        p -= v
    ans.append((L[-2], p))
    print(L[-2] - p)
    for x, y in ans:
        print(x, y) c == 2 c 2 if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

     N == 2 N 2 print(max(L) - min(L)) print max(L) - min(L) max(L) max L min(L) min L print(max(L), min(L)) print max(L) max L min(L) min L exit() exit ans = [] ans [] p = L[0] - L[-1] p L[0] - L[-1] L[0] L 0 L[-1] L -1 ans.append((L[0], L[-1])) ans.append ans append (L[0], L[-1]) L[0] L 0 L[-1] L -1 for v in L[1:-2]:
        ans.append((p, v))
        p -= v
     v L[1:-2] L 1:-2 1 -2 ans.append((p, v)) ans.append ans append (p, v) p v p -= v p v ans.append((L[-2], p)) ans.append ans append (L[-2], p) L[-2] L -2 p print(L[-2] - p) print L[-2] - p L[-2] L -2 p for x, y in ans:
        print(x, y) x y ans print(x, y) print x y if c == 1:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    ans = []
    p = L[-1] - L[0]
    ans.append((L[-1], L[0]))
    for v in L[1:-2]:
        ans.append((p, v))
        p -= v
    ans.append((p, L[-2]))
    print(p - L[-2])
    for x, y in ans:
        print(x, y) c == 1 c 1 if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

     N == 2 N 2 print(max(L) - min(L)) print max(L) - min(L) max(L) max L min(L) min L print(max(L), min(L)) print max(L) max L min(L) min L exit() exit ans = [] ans [] p = L[-1] - L[0] p L[-1] - L[0] L[-1] L -1 L[0] L 0 ans.append((L[-1], L[0])) ans.append ans append (L[-1], L[0]) L[-1] L -1 L[0] L 0 for v in L[1:-2]:
        ans.append((p, v))
        p -= v
     v L[1:-2] L 1:-2 1 -2 ans.append((p, v)) ans.append ans append (p, v) p v p -= v p v ans.append((p, L[-2])) ans.append ans append (p, L[-2]) p L[-2] L -2 print(p - L[-2]) print p - L[-2] p L[-2] L -2 for x, y in ans:
        print(x, y) x y ans print(x, y) print x y if c == 3:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    mc = 0
    for v in L:
        if v < 0:
            mc += 1

    ans = []
    if N - mc == 1:
        p = L[-1] - L[0]
        ans.append((L[-1], L[0]))
        for v in L[1:-1]:
            ans.append((p, v))
            p -= v
        print(p)
        for x, y in ans:
            print(x, y)

        exit()

    ans = []
    p = L[0] - L[-1]
    ans.append((L[0], L[-1]))
    for v in L[mc:-2]:
        ans.append((p, v))
        p -= v
    ans.append((L[-2], p))
    p = L[-2] - p
    for v in L[1:mc]:
        ans.append((p, v))
        p -= v
    print(p)
    for x, y in ans:
        print(x, y) c == 3 c 3 if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

     N == 2 N 2 print(max(L) - min(L)) print max(L) - min(L) max(L) max L min(L) min L print(max(L), min(L)) print max(L) max L min(L) min L exit() exit mc = 0 mc 0 for v in L:
        if v < 0:
            mc += 1

     v L if v < 0:
            mc += 1

     v < 0 v 0 mc += 1 mc 1 ans = [] ans [] if N - mc == 1:
        p = L[-1] - L[0]
        ans.append((L[-1], L[0]))
        for v in L[1:-1]:
            ans.append((p, v))
            p -= v
        print(p)
        for x, y in ans:
            print(x, y)

        exit()

     N - mc == 1 N - mc N mc 1 p = L[-1] - L[0] p L[-1] - L[0] L[-1] L -1 L[0] L 0 ans.append((L[-1], L[0])) ans.append ans append (L[-1], L[0]) L[-1] L -1 L[0] L 0 for v in L[1:-1]:
            ans.append((p, v))
            p -= v
         v L[1:-1] L 1:-1 1 -1 ans.append((p, v)) ans.append ans append (p, v) p v p -= v p v print(p) print p for x, y in ans:
            print(x, y)

         x y ans print(x, y) print x y exit() exit ans = [] ans [] p = L[0] - L[-1] p L[0] - L[-1] L[0] L 0 L[-1] L -1 ans.append((L[0], L[-1])) ans.append ans append (L[0], L[-1]) L[0] L 0 L[-1] L -1 for v in L[mc:-2]:
        ans.append((p, v))
        p -= v
     v L[mc:-2] L mc:-2 mc -2 ans.append((p, v)) ans.append ans append (p, v) p v p -= v p v ans.append((L[-2], p)) ans.append ans append (L[-2], p) L[-2] L -2 p p = L[-2] - p p L[-2] - p L[-2] L -2 p for v in L[1:mc]:
        ans.append((p, v))
        p -= v
     v L[1:mc] L 1:mc 1 mc ans.append((p, v)) ans.append ans append (p, v) p v p -= v p v print(p) print p for x, y in ans:
        print(x, y) x y ans print(x, y) print x y mc += 1 1 mc L = [int(v) for v in input().split()] [int(v) for v in input().split()] L p -= v v p p -= v v p p = L[0] - L[-1] L[0] - L[-1] p ans = [] [] ans ans = [] [] ans p -= v v p ans = [] [] ans c = c | 1 c | 1 c c = c | 2 c | 2 c p -= v v p mc = 0 0 mc p -= v v p N, = map(int, input().split()) map(int, input().split()) N c = 2 2 c p = L[-1] - L[0] L[-1] - L[0] p p = L[-1] - L[0] L[-1] - L[0] p p = L[-2] - p L[-2] - p p input = sys.stdin.readline sys.stdin.readline input c = 0 0 c p = L[0] - L[-1] L[0] - L[-1] p ans = [] [] ans
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial, ceil, floor
from collections import defaultdict
sys.setrecursionlimit(200000)
input = sys.stdin.readline

# N, M, = map(int, input().split())
# N = int(input())
# L = [int(v) for v in input().split()]
# L = [[int(v) for v in input().split()] for _ in range(N)]
# L = [int(input()) for _ in range(N)]
# L = [list(input().strip())  for _ in range(N)]
# S = input().strip()

N, = map(int, input().split())
L = [int(v) for v in input().split()]
L.sort()

# only + 2
# only - 1
# + - 3
c = 0
for v in L:
    if v < 0:
        c = c | 1
    elif v > 0:
        c = c | 2

if c == 0:
    c = 2

if c == 2:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    ans = []
    p = L[0] - L[-1]
    ans.append((L[0], L[-1]))
    for v in L[1:-2]:
        ans.append((p, v))
        p -= v
    ans.append((L[-2], p))
    print(L[-2] - p)
    for x, y in ans:
        print(x, y)

if c == 1:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    ans = []
    p = L[-1] - L[0]
    ans.append((L[-1], L[0]))
    for v in L[1:-2]:
        ans.append((p, v))
        p -= v
    ans.append((p, L[-2]))
    print(p - L[-2])
    for x, y in ans:
        print(x, y)

if c == 3:
    if N == 2:
        print(max(L) - min(L))
        print(max(L), min(L))
        exit()

    mc = 0
    for v in L:
        if v < 0:
            mc += 1

    ans = []
    if N - mc == 1:
        p = L[-1] - L[0]
        ans.append((L[-1], L[0]))
        for v in L[1:-1]:
            ans.append((p, v))
            p -= v
        print(p)
        for x, y in ans:
            print(x, y)

        exit()

    ans = []
    p = L[0] - L[-1]
    ans.append((L[0], L[-1]))
    for v in L[mc:-2]:
        ans.append((p, v))
        p -= v
    ans.append((L[-2], p))
    p = L[-2] - p
    for v in L[1:mc]:
        ans.append((p, v))
        p -= v
    print(p)
    for x, y in ans:
        print(x, y)