import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from bisect import bisect_right

n = int(readline())
a = list(map(int, readline().split()))
a.sort()
if a[0] <= 0 and a[-1] >= 0:
    print(sum(map(lambda x: abs(int(x)), a)))
    idx = bisect_right(a, 0)
    idx -= 1 if idx == n else 0
    x = a[0]
    y = a[idx]
    for aa in a[1:idx]:
        print(y, aa)
        y -= aa
    for aa in a[idx + 1:]:
        print(x, aa)
        x -= aa
    print(y, x)
else:
    if a[0] < 0:
        print(-sum(a) + 2 * a[-1])
        a = a[::-1]
    else:
        print(sum(a) - 2 * a[0])
    x = a[0]
    y = a[-1]
    for aa in a[1:-1]:
        print(x, aa)
        x -= aa
    if a[0] < 0:
        y, x = x, y
    print(y, x) import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 from bisect import bisect_right n = int(readline()) n int(readline()) int readline() readline a = list(map(int, readline().split())) a list(map(int, readline().split())) list map(int, readline().split()) map int readline().split() ().split () readline split a.sort() a.sort a sort if a[0] <= 0 and a[-1] >= 0:
    print(sum(map(lambda x: abs(int(x)), a)))
    idx = bisect_right(a, 0)
    idx -= 1 if idx == n else 0
    x = a[0]
    y = a[idx]
    for aa in a[1:idx]:
        print(y, aa)
        y -= aa
    for aa in a[idx + 1:]:
        print(x, aa)
        x -= aa
    print(y, x)
else:
    if a[0] < 0:
        print(-sum(a) + 2 * a[-1])
        a = a[::-1]
    else:
        print(sum(a) - 2 * a[0])
    x = a[0]
    y = a[-1]
    for aa in a[1:-1]:
        print(x, aa)
        x -= aa
    if a[0] < 0:
        y, x = x, y
    print(y, x) a[0] <= 0 and a[-1] >= 0 a[0] <= 0 a[0] a 0 0 a[-1] >= 0 a[-1] a -1 0 print(sum(map(lambda x: abs(int(x)), a))) print sum(map(lambda x: abs(int(x)), a)) sum map(lambda x: abs(int(x)), a) map lambda x: abs(int(x)) abs(int(x)) abs int(x) int x x a idx = bisect_right(a, 0) idx bisect_right(a, 0) bisect_right a 0 idx -= 1 if idx == n else 0 idx 1 if idx == n else 0 idx == n idx n 1 0 x = a[0] x a[0] a 0 y = a[idx] y a[idx] a idx for aa in a[1:idx]:
        print(y, aa)
        y -= aa
     aa a[1:idx] a 1:idx 1 idx print(y, aa) print y aa y -= aa y aa for aa in a[idx + 1:]:
        print(x, aa)
        x -= aa
     aa a[idx + 1:] a idx + 1: idx + 1 idx 1 print(x, aa) print x aa x -= aa x aa print(y, x) print y x if a[0] < 0:
        print(-sum(a) + 2 * a[-1])
        a = a[::-1]
    else:
        print(sum(a) - 2 * a[0])
     a[0] < 0 a[0] a 0 0 print(-sum(a) + 2 * a[-1]) print -sum(a) + 2 * a[-1] -sum(a) sum(a) sum a 2 * a[-1] 2 a[-1] a -1 a = a[::-1] a a[::-1] a ::-1 -1 print(sum(a) - 2 * a[0]) print sum(a) - 2 * a[0] sum(a) sum a 2 * a[0] 2 a[0] a 0 x = a[0] x a[0] a 0 y = a[-1] y a[-1] a -1 for aa in a[1:-1]:
        print(x, aa)
        x -= aa
     aa a[1:-1] a 1:-1 1 -1 print(x, aa) print x aa x -= aa x aa if a[0] < 0:
        y, x = x, y
     a[0] < 0 a[0] a 0 0 y, x = x, y y x x y print(y, x) print y x idx -= 1 if idx == n else 0 1 if idx == n else 0 idx x -= aa aa x idx = bisect_right(a, 0) bisect_right(a, 0) idx x -= aa aa x readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines x = a[0] a[0] x x = x, y y x n = int(readline()) int(readline()) n readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline a = list(map(int, readline().split())) list(map(int, readline().split())) a y, x = x, y x y a = a[::-1] a[::-1] a y = a[idx] a[idx] y x = a[0] a[0] x y = a[-1] a[-1] y y -= aa aa y read = sys.stdin.buffer.read sys.stdin.buffer.read read
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from bisect import bisect_right

n = int(readline())
a = list(map(int, readline().split()))
a.sort()
if a[0] <= 0 and a[-1] >= 0:
    print(sum(map(lambda x: abs(int(x)), a)))
    idx = bisect_right(a, 0)
    idx -= 1 if idx == n else 0
    x = a[0]
    y = a[idx]
    for aa in a[1:idx]:
        print(y, aa)
        y -= aa
    for aa in a[idx + 1:]:
        print(x, aa)
        x -= aa
    print(y, x)
else:
    if a[0] < 0:
        print(-sum(a) + 2 * a[-1])
        a = a[::-1]
    else:
        print(sum(a) - 2 * a[0])
    x = a[0]
    y = a[-1]
    for aa in a[1:-1]:
        print(x, aa)
        x -= aa
    if a[0] < 0:
        y, x = x, y
    print(y, x)
