n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0] >= 0:
    print(sum(a) - 2 * a[0])
    x, y = a[0], 0
    for i in range(n - 2):
        x -= y
        y = a[i + 1]
        print(x, y)
    x -= y
    print(a[-1], x)
elif a[-1] <= 0:
    print(-sum(a) + 2 * a[-1])
    x, y = a[-1], 0
    for i in range(n - 1):
        x -= y
        y = a[-(i + 2)]
        print(x, y)
else:
    m = 0
    c = 0
    for i in range(n):
        m += abs(a[i])
        if a[i] <= 0:
            c = i
    print(m)
    x, y = a[0], 0
    for i in range(n - 1, c + 1, -1):
        x -= y
        y = a[i]
        print(x, y)
    x -= y
    print(a[c + 1], x)
    x = a[c + 1] - x
    for i in range(1, c + 1):
        y = a[i]
        print(x, y)
        x -= y n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split a.sort() a.sort a sort if a[0] >= 0:
    print(sum(a) - 2 * a[0])
    x, y = a[0], 0
    for i in range(n - 2):
        x -= y
        y = a[i + 1]
        print(x, y)
    x -= y
    print(a[-1], x)
elif a[-1] <= 0:
    print(-sum(a) + 2 * a[-1])
    x, y = a[-1], 0
    for i in range(n - 1):
        x -= y
        y = a[-(i + 2)]
        print(x, y)
else:
    m = 0
    c = 0
    for i in range(n):
        m += abs(a[i])
        if a[i] <= 0:
            c = i
    print(m)
    x, y = a[0], 0
    for i in range(n - 1, c + 1, -1):
        x -= y
        y = a[i]
        print(x, y)
    x -= y
    print(a[c + 1], x)
    x = a[c + 1] - x
    for i in range(1, c + 1):
        y = a[i]
        print(x, y)
        x -= y a[0] >= 0 a[0] a 0 0 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, y = a[0], 0 x a[0] a 0 y 0 for i in range(n - 2):
        x -= y
        y = a[i + 1]
        print(x, y)
     i range(n - 2) range n - 2 n 2 x -= y x y y = a[i + 1] y a[i + 1] a i + 1 i 1 print(x, y) print x y x -= y x y print(a[-1], x) print a[-1] a -1 x elif a[-1] <= 0:
    print(-sum(a) + 2 * a[-1])
    x, y = a[-1], 0
    for i in range(n - 1):
        x -= y
        y = a[-(i + 2)]
        print(x, y) a[-1] <= 0 a[-1] a -1 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 x, y = a[-1], 0 x a[-1] a -1 y 0 for i in range(n - 1):
        x -= y
        y = a[-(i + 2)]
        print(x, y) i range(n - 1) range n - 1 n 1 x -= y x y y = a[-(i + 2)] y a[-(i + 2)] a -(i + 2) i + 2 i 2 print(x, y) print x y m = 0 m 0 c = 0 c 0 for i in range(n):
        m += abs(a[i])
        if a[i] <= 0:
            c = i
     i range(n) range n m += abs(a[i]) m abs(a[i]) abs a[i] a i if a[i] <= 0:
            c = i
     a[i] <= 0 a[i] a i 0 c = i c i print(m) print m x, y = a[0], 0 x a[0] a 0 y 0 for i in range(n - 1, c + 1, -1):
        x -= y
        y = a[i]
        print(x, y)
     i range(n - 1, c + 1, -1) range n - 1 n 1 c + 1 c 1 -1 x -= y x y y = a[i] y a[i] a i print(x, y) print x y x -= y x y print(a[c + 1], x) print a[c + 1] a c + 1 c 1 x x = a[c + 1] - x x a[c + 1] - x a[c + 1] a c + 1 c 1 x for i in range(1, c + 1):
        y = a[i]
        print(x, y)
        x -= y i range(1, c + 1) range 1 c + 1 c 1 y = a[i] y a[i] a i print(x, y) print x y x -= y x y y = a[i + 1] a[i + 1] y y = a[i] a[i] y n = int(input()) int(input()) n x -= y y x x = a[c + 1] - x a[c + 1] - x x y = a[0], 0 0 y x -= y y x x -= y y x y = a[-(i + 2)] a[-(i + 2)] y a = list(map(int, input().split())) list(map(int, input().split())) a x -= y y x y = a[0], 0 0 y m = 0 0 m x -= y y x x, y = a[0], 0 a[0] x x, y = a[-1], 0 a[-1] x c = 0 0 c x -= y y x c = i i c y = a[i] a[i] y m += abs(a[i]) abs(a[i]) m x, y = a[0], 0 a[0] x y = a[-1], 0 0 y
n = int(input())
a = list(map(int, input().split()))
a.sort()
if a[0] >= 0:
    print(sum(a) - 2 * a[0])
    x, y = a[0], 0
    for i in range(n - 2):
        x -= y
        y = a[i + 1]
        print(x, y)
    x -= y
    print(a[-1], x)
elif a[-1] <= 0:
    print(-sum(a) + 2 * a[-1])
    x, y = a[-1], 0
    for i in range(n - 1):
        x -= y
        y = a[-(i + 2)]
        print(x, y)
else:
    m = 0
    c = 0
    for i in range(n):
        m += abs(a[i])
        if a[i] <= 0:
            c = i
    print(m)
    x, y = a[0], 0
    for i in range(n - 1, c + 1, -1):
        x -= y
        y = a[i]
        print(x, y)
    x -= y
    print(a[c + 1], x)
    x = a[c + 1] - x
    for i in range(1, c + 1):
        y = a[i]
        print(x, y)
        x -= y