N = int(eval(input()))

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



pos = []

neg = []

zeros = 0

for a in A:

    if a > 0:

        pos.append(a)

    elif a < 0:

        neg.append(a)

    else:

        zeros += 1



pos.sort()

neg.sort()



ope = []



if len(pos) == len(neg) == 0:

    print((0))

    for i in range(N-1):

        print((0,0))

    exit()



if len(neg) == 0:

    if zeros:

        ope.append((0,pos[-1]))

        neg.append(-pos[-1])

        zeros -= 1

        pos.pop()

    else:

        ope.append((pos[0],pos[-1]))

        neg.append(pos[0] - pos[-1])

        pos = pos[1:-1]



elif len(pos) == 0:

    if zeros:

        ope.append((0,neg[0]))

        pos.append(-neg[0])

        zeros -= 1

        neg = neg[1:]

    else:

        ope.append((neg[-1],neg[0]))

        pos.append(neg[-1] - neg[0])

        neg = neg[1:-1]



for p in pos[:-1]:

    ope.append((neg[0], p))

    neg[0] -= p



for n in neg[1:]:

    ope.append((pos[-1], n))

    pos[-1] -= n



ope.append((pos[-1], neg[0]))

ans = pos[-1] - neg[0]

for z in range(zeros):

    ope.append((ans, 0))



print(ans)

for x,y in ope:

    print((x,y))
N = int(eval(input()))

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

A.sort()



from collections import deque

q = deque(A)

mn = q.popleft()

mx = q.pop()



arr = []

for a in q:

    if a >= 0:

        arr.append((mn, a))

        mn -= a

    else:

        arr.append((mx, a))

        mx -= a

arr.append((mx, mn))

print((mx - mn))

for a,b in arr:

    print((a,b))
N = int(eval(input()))
A = list(map(int, input().split()))
pos = []
neg = []
zeros = 0
for a in A:
    if a > 0:
        pos.append(a)
    elif a < 0:
        neg.append(a)
    else:
        zeros += 1
pos.sort()
neg.sort()
ope = []
if len(pos) == len(neg) == 0:
    print((0))
    for i in range(N - 1):
        print((0, 0))
    exit()
if len(neg) == 0:
    if zeros:
        ope.append((0, pos[-1]))
        neg.append(-pos[-1])
        zeros -= 1
        pos.pop()
    else:
        ope.append((pos[0], pos[-1]))
        neg.append(pos[0] - pos[-1])
        pos = pos[1:-1]
elif len(pos) == 0:
    if zeros:
        ope.append((0, neg[0]))
        pos.append(-neg[0])
        zeros -= 1
        neg = neg[1:]
    else:
        ope.append((neg[-1], neg[0]))
        pos.append(neg[-1] - neg[0])
        neg = neg[1:-1]
for p in pos[:-1]:
    ope.append((neg[0], p))
    neg[0] -= p
for n in neg[1:]:
    ope.append((pos[-1], n))
    pos[-1] -= n
ope.append((pos[-1], neg[0]))
ans = pos[-1] - neg[0]
for z in range(zeros):
    ope.append((ans, 0))
print(ans)
for x, y in ope:
    print((x, y))

N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
from collections import deque

q = deque(A)
mn = q.popleft()
mx = q.pop()
arr = []
for a in q:
    if a >= 0:
        arr.append((mn, a))
        mn -= a
    else:
        arr.append((mx, a))
        mx -= a
arr.append((mx, mn))
print((mx - mn))
for a, b in arr:
    print((a, b))

-pos = [] -neg = [] -zeros = 0 -for a in A: -    if a > 0: -        pos.append(a) -    elif a < 0: -        neg.append(a) +A.sort() +from collections import deque + +q = deque(A) +mn = q.popleft() +mx = q.pop() +arr = [] +for a in q: +    if a >= 0: +        arr.append((mn, a)) +        mn -= a -        zeros += 1 -pos.sort() -neg.sort() -ope = [] -if len(pos) == len(neg) == 0: -    print((0)) -    for i in range(N - 1): -        print((0, 0)) -    exit() -if len(neg) == 0: -    if zeros: -        ope.append((0, pos[-1])) -        neg.append(-pos[-1]) -        zeros -= 1 -        pos.pop() -    else: -        ope.append((pos[0], pos[-1])) -        neg.append(pos[0] - pos[-1]) -        pos = pos[1:-1] -elif len(pos) == 0: -    if zeros: -        ope.append((0, neg[0])) -        pos.append(-neg[0]) -        zeros -= 1 -        neg = neg[1:] -    else: -        ope.append((neg[-1], neg[0])) -        pos.append(neg[-1] - neg[0]) -        neg = neg[1:-1] -for p in pos[:-1]: -    ope.append((neg[0], p)) -    neg[0] -= p -for n in neg[1:]: -    ope.append((pos[-1], n)) -    pos[-1] -= n -ope.append((pos[-1], neg[0])) -ans = pos[-1] - neg[0] -for z in range(zeros): -    ope.append((ans, 0)) -print(ans) -for x, y in ope: -    print((x, y)) +        arr.append((mx, a)) +        mx -= a +arr.append((mx, mn)) +print((mx - mn)) +for a, b in arr: +    print((a, b))