n=int(eval(input()))

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



XY=[]

left,right=A[0],A[-1]

for i in range(1,n-1):

    num=A[i]

    if num<0:

        XY.append([right,num])

        right -=num

    else:

        XY.append([left,num])

        left -=num

XY.append([right,left])

print((right-left))

for x,y in XY:print((x,y))
from collections import deque

n=int(eval(input()))

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

A=deque(A)



N=[]

left,right=A.popleft(),A.pop()

for i in A:

    if i<0:

        N.append([right,i])

        right -=i

    else:

        N.append([left,i])

        left -=i

N.append([right,left])

print((right-left))

for i in N:print((*i))
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
XY = []
left, right = A[0], A[-1]
for i in range(1, n - 1):
    num = A[i]
    if num < 0:
        XY.append([right, num])
        right -= num
    else:
        XY.append([left, num])
        left -= num
XY.append([right, left])
print((right - left))
for x, y in XY:
    print((x, y))

from collections import deque

n = int(eval(input()))
A = sorted(list(map(int, input().split())))
A = deque(A)
N = []
left, right = A.popleft(), A.pop()
for i in A:
    if i < 0:
        N.append([right, i])
        right -= i
    else:
        N.append([left, i])
        left -= i
N.append([right, left])
print((right - left))
for i in N:
    print((*i))

+from collections import deque + -XY = [] -left, right = A[0], A[-1] -for i in range(1, n - 1): -    num = A[i] -    if num < 0: -        XY.append([right, num]) -        right -= num +A = deque(A) +N = [] +left, right = A.popleft(), A.pop() +for i in A: +    if i < 0: +        N.append([right, i]) +        right -= i -        XY.append([left, num]) -        left -= num -XY.append([right, left]) +        N.append([left, i]) +        left -= i +N.append([right, left]) -for x, y in XY: -    print((x, y)) +for i in N: +    print((*i))