n = int(input())
a = list(map(int, input().split()))
a.sort()
x, y = a[0], a[-1]
w, z = a[0], a[-1]
for i in a[1:-1]:
    if i < 0:
        y -= i
    else:
        x -= i
print(y - x)
for i in a[1:-1]:
    if i < 0:
        print(z, i)
        z -= i
    else:
        print(w, i)
        w -= i
print(z, w) 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 x, y = a[0], a[-1] x a[0] a 0 y a[-1] a -1 w, z = a[0], a[-1] w a[0] a 0 z a[-1] a -1 for i in a[1:-1]:
    if i < 0:
        y -= i
    else:
        x -= i i a[1:-1] a 1:-1 1 -1 if i < 0:
        y -= i
    else:
        x -= i i < 0 i 0 y -= i y i x -= i x i print(y - x) print y - x y x for i in a[1:-1]:
    if i < 0:
        print(z, i)
        z -= i
    else:
        print(w, i)
        w -= i i a[1:-1] a 1:-1 1 -1 if i < 0:
        print(z, i)
        z -= i
    else:
        print(w, i)
        w -= i i < 0 i 0 print(z, i) print z i z -= i z i print(w, i) print w i w -= i w i print(z, w) print z w a = list(map(int, input().split())) list(map(int, input().split())) a y = a[0], a[-1] a[-1] y x -= i i x z = a[0], a[-1] a[-1] z y -= i i y z -= i i z x, y = a[0], a[-1] a[0] x w, z = a[0], a[-1] a[0] w w -= i i w n = int(input()) int(input()) n
n = int(input())
a = list(map(int, input().split()))
a.sort()
x, y = a[0], a[-1]
w, z = a[0], a[-1]
for i in a[1:-1]:
    if i < 0:
        y -= i
    else:
        x -= i
print(y - x)
for i in a[1:-1]:
    if i < 0:
        print(z, i)
        z -= i
    else:
        print(w, i)
        w -= i
print(z, w)