N = int(eval(input()))

A = sorted(list(map(int, input().split())))



M = A[-1]

m = A[0]



ans = []

for i, a in enumerate(A[1:-1]):

    if a > 0:

        ans.append([m, a])

        m -= a

    else:

        ans.append([M, a])

        M -= a



print((M - m))

ans.append([M, m])

for a1, a2 in ans:

    print((a1, a2))

from collections import deque

N = int(eval(input()))

A = deque(sorted(list(map(int, input().split()))))

MAX, MIN = A.pop(), A.popleft()



ans = []

while len(A):

    if A[0] < 0:

        x, y = MAX, A.popleft()

        ans.append([MAX, y])

        MAX = MAX - y

    else:

        x, y = MIN, A.popleft()

        ans.append([x, y])

        MIN = MIN - y



ans.append([MAX, MIN])

print((MAX - MIN))

for x, y in ans:

    print((x, y))

N = int(eval(input()))
A = sorted(list(map(int, input().split())))
M = A[-1]
m = A[0]
ans = []
for i, a in enumerate(A[1:-1]):
    if a > 0:
        ans.append([m, a])
        m -= a
    else:
        ans.append([M, a])
        M -= a
print((M - m))
ans.append([M, m])
for a1, a2 in ans:
    print((a1, a2))

from collections import deque

N = int(eval(input()))
A = deque(sorted(list(map(int, input().split()))))
MAX, MIN = A.pop(), A.popleft()
ans = []
while len(A):
    if A[0] < 0:
        x, y = MAX, A.popleft()
        ans.append([MAX, y])
        MAX = MAX - y
    else:
        x, y = MIN, A.popleft()
        ans.append([x, y])
        MIN = MIN - y
ans.append([MAX, MIN])
print((MAX - MIN))
for x, y in ans:
    print((x, y))

+from collections import deque + -A = sorted(list(map(int, input().split()))) -M = A[-1] -m = A[0] +A = deque(sorted(list(map(int, input().split())))) +MAX, MIN = A.pop(), A.popleft() -for i, a in enumerate(A[1:-1]): -    if a > 0: -        ans.append([m, a]) -        m -= a +while len(A): +    if A[0] < 0: +        x, y = MAX, A.popleft() +        ans.append([MAX, y]) +        MAX = MAX - y -        ans.append([M, a]) -        M -= a -print((M - m)) -ans.append([M, m]) -for a1, a2 in ans: -    print((a1, a2)) +        x, y = MIN, A.popleft() +        ans.append([x, y]) +        MIN = MIN - y +ans.append([MAX, MIN]) +print((MAX - MIN)) +for x, y in ans: +    print((x, y))