n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
add, sub = [a[0]], [a[-1]]
for i in range(1, n-1):
    if a[i] >= 0:
        add.append(a[i])
    else:
        sub.append(a[i])
res = []
it = len(add)-1
while it > 0:
    res.append([sub[-1],add[it]])
    sub[-1] -= add[it]
    it -= 1
it = len(sub)-1
while it >= 0:
    res.append([add[0],sub[it]])
    add[0] -= sub[it]
    it -= 1
print(add[0])
print("\n".join([" ".join(map(str,x)) for x in res]))

 n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x a = [int(x) for x in input().split()] a [int(x) for x in input().split()] a.sort(reverse=True) a.sort a sort reverse=True reverse True add, sub = [a[0]], [a[-1]] add [a[0]] a[0] a 0 sub [a[-1]] a[-1] a -1 for i in range(1, n-1):
    if a[i] >= 0:
        add.append(a[i])
    else:
        sub.append(a[i]) i range(1, n-1) range 1 n-1 n 1 if a[i] >= 0:
        add.append(a[i])
    else:
        sub.append(a[i]) a[i] >= 0 a[i] a i 0 add.append(a[i]) add.append add append a[i] a i sub.append(a[i]) sub.append sub append a[i] a i res = [] res [] it = len(add)-1 it len(add)-1 len(add) len add 1 while it > 0:
    res.append([sub[-1],add[it]])
    sub[-1] -= add[it]
    it -= 1 it > 0 it 0 res.append([sub[-1],add[it]]) res.append res append [sub[-1],add[it]] sub[-1] sub -1 add[it] add it sub[-1] -= add[it] sub[-1] sub -1 add[it] add it it -= 1 it 1 it = len(sub)-1 it len(sub)-1 len(sub) len sub 1 while it >= 0:
    res.append([add[0],sub[it]])
    add[0] -= sub[it]
    it -= 1 it >= 0 it 0 res.append([add[0],sub[it]]) res.append res append [add[0],sub[it]] add[0] add 0 sub[it] sub it add[0] -= sub[it] add[0] add 0 sub[it] sub it it -= 1 it 1 print(add[0]) print add[0] add 0 " ".join(map(str,x)) for x in res for x in res x res for x in res " ".join(map(str,x)) " ".join " " join map(str,x) map str x print("\n".join([" ".join(map(str,x)) for x in res])) print "\n".join([" ".join(map(str,x)) for x in res]) "\n".join "\n" join [" ".join(map(str,x)) for x in res] n = int(input()) int(input()) n sub = [a[0]], [a[-1]] [a[-1]] sub a = [int(x) for x in input().split()] [int(x) for x in input().split()] a it = len(add)-1 len(add)-1 it it -= 1 1 it add, sub = [a[0]], [a[-1]] [a[0]] add it = len(sub)-1 len(sub)-1 it it -= 1 1 it res = [] [] res
n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
add, sub = [a[0]], [a[-1]]
for i in range(1, n-1):
    if a[i] >= 0:
        add.append(a[i])
    else:
        sub.append(a[i])
res = []
it = len(add)-1
while it > 0:
    res.append([sub[-1],add[it]])
    sub[-1] -= add[it]
    it -= 1
it = len(sub)-1
while it >= 0:
    res.append([add[0],sub[it]])
    add[0] -= sub[it]
    it -= 1
print(add[0])
print("\n".join([" ".join(map(str,x)) for x in res]))


