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

pos = []
neg = []
for a in A:
    if 0 <= a:
        pos.append(a)
    else:
        neg.append(a)


ans = []
if pos:
    if not neg:
        pos.sort(reverse=True)
        neg.append(pos.pop())

    while len(pos) != 1:
        x = pos.pop()
        ans.append((neg[-1], x))
        neg[-1] -= x
else:
    neg.sort()
    pos.append(neg.pop())

pos = pos[0]
while neg:
    x = neg.pop()
    ans.append((pos, x))
    pos -= x

print(pos)
for row in ans:
    print(*row) n = int(input()) n int(input()) int input() input A = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split pos = [] pos [] neg = [] neg [] for a in A:
    if 0 <= a:
        pos.append(a)
    else:
        neg.append(a) a A if 0 <= a:
        pos.append(a)
    else:
        neg.append(a) 0 <= a 0 a pos.append(a) pos.append pos append a neg.append(a) neg.append neg append a ans = [] ans [] if pos:
    if not neg:
        pos.sort(reverse=True)
        neg.append(pos.pop())

    while len(pos) != 1:
        x = pos.pop()
        ans.append((neg[-1], x))
        neg[-1] -= x
else:
    neg.sort()
    pos.append(neg.pop()) pos if not neg:
        pos.sort(reverse=True)
        neg.append(pos.pop())

     not neg neg pos.sort(reverse=True) pos.sort pos sort reverse=True reverse True neg.append(pos.pop()) neg.append neg append pos.pop() pos.pop pos pop while len(pos) != 1:
        x = pos.pop()
        ans.append((neg[-1], x))
        neg[-1] -= x len(pos) != 1 len(pos) len pos 1 x = pos.pop() x pos.pop() pos.pop pos pop ans.append((neg[-1], x)) ans.append ans append (neg[-1], x) neg[-1] neg -1 x neg[-1] -= x neg[-1] neg -1 x neg.sort() neg.sort neg sort pos.append(neg.pop()) pos.append pos append neg.pop() neg.pop neg pop pos = pos[0] pos pos[0] pos 0 while neg:
    x = neg.pop()
    ans.append((pos, x))
    pos -= x neg x = neg.pop() x neg.pop() neg.pop neg pop ans.append((pos, x)) ans.append ans append (pos, x) pos x pos -= x pos x print(pos) print pos for row in ans:
    print(*row) row ans print(*row) print *row row pos = [] [] pos x = neg.pop() neg.pop() x neg = [] [] neg ans = [] [] ans x = pos.pop() pos.pop() x pos -= x x pos pos = pos[0] pos[0] pos n = int(input()) int(input()) n A = map(int, input().split()) map(int, input().split()) A
n = int(input())
A = map(int, input().split())

pos = []
neg = []
for a in A:
    if 0 <= a:
        pos.append(a)
    else:
        neg.append(a)


ans = []
if pos:
    if not neg:
        pos.sort(reverse=True)
        neg.append(pos.pop())

    while len(pos) != 1:
        x = pos.pop()
        ans.append((neg[-1], x))
        neg[-1] -= x
else:
    neg.sort()
    pos.append(neg.pop())

pos = pos[0]
while neg:
    x = neg.pop()
    ans.append((pos, x))
    pos -= x

print(pos)
for row in ans:
    print(*row)