n = int(input())
a = list(map(int , input().split()))
pos = sorted([i for i in a if i >= 0], reverse=True)
neg = sorted([i for i in a if i < 0], reverse=True)

ans = []
if len(neg) == 0 and len(pos) == 2:
    print(pos[0] - pos[1])
    print(pos[0], pos[1])
    exit()
elif len(pos) == 0:
    tmp = neg[0]
    for i in range(1,len(neg)):
        ans.append([tmp, neg[i]])
        tmp -= neg[i]
    print(tmp)
    [print(*i) for i in ans]
    exit()
elif len(neg) == 0:
    neg.append(pos.pop())

tmp = neg.pop()
while len(pos) > 1:
    a = pos.pop()
    ans.append([tmp, a])
    tmp -= a
neg.append(tmp)

tmp = pos[0]
for i in neg:
    ans.append([tmp, i])
    tmp -= i

print(tmp)
[print(*i) for i in ans] n = int(input()) n int(input()) int input() input a = list(map(int , input().split())) a list(map(int , input().split())) list map(int , input().split()) map int input().split() ().split () input split i for i in a if i >= 0 for i in a if i >= 0 i a i >= 0 i 0 if i >= 0 i pos = sorted([i for i in a if i >= 0], reverse=True) pos sorted([i for i in a if i >= 0], reverse=True) sorted [i for i in a if i >= 0] reverse=True reverse True i for i in a if i < 0 for i in a if i < 0 i a i < 0 i 0 if i < 0 i neg = sorted([i for i in a if i < 0], reverse=True) neg sorted([i for i in a if i < 0], reverse=True) sorted [i for i in a if i < 0] reverse=True reverse True ans = [] ans [] if len(neg) == 0 and len(pos) == 2:
    print(pos[0] - pos[1])
    print(pos[0], pos[1])
    exit()
elif len(pos) == 0:
    tmp = neg[0]
    for i in range(1,len(neg)):
        ans.append([tmp, neg[i]])
        tmp -= neg[i]
    print(tmp)
    [print(*i) for i in ans]
    exit()
elif len(neg) == 0:
    neg.append(pos.pop()) len(neg) == 0 and len(pos) == 2 len(neg) == 0 len(neg) len neg 0 len(pos) == 2 len(pos) len pos 2 print(pos[0] - pos[1]) print pos[0] - pos[1] pos[0] pos 0 pos[1] pos 1 print(pos[0], pos[1]) print pos[0] pos 0 pos[1] pos 1 exit() exit elif len(pos) == 0:
    tmp = neg[0]
    for i in range(1,len(neg)):
        ans.append([tmp, neg[i]])
        tmp -= neg[i]
    print(tmp)
    [print(*i) for i in ans]
    exit() len(pos) == 0 len(pos) len pos 0 tmp = neg[0] tmp neg[0] neg 0 for i in range(1,len(neg)):
        ans.append([tmp, neg[i]])
        tmp -= neg[i]
     i range(1,len(neg)) range 1 len(neg) len neg ans.append([tmp, neg[i]]) ans.append ans append [tmp, neg[i]] tmp neg[i] neg i tmp -= neg[i] tmp neg[i] neg i print(tmp) print tmp print(*i) for i in ans for i in ans i ans for i in ans print(*i) print *i i [print(*i) for i in ans] exit() exit elif len(neg) == 0:
    neg.append(pos.pop()) len(neg) == 0 len(neg) len neg 0 neg.append(pos.pop()) neg.append neg append pos.pop() pos.pop pos pop tmp = neg.pop() tmp neg.pop() neg.pop neg pop while len(pos) > 1:
    a = pos.pop()
    ans.append([tmp, a])
    tmp -= a len(pos) > 1 len(pos) len pos 1 a = pos.pop() a pos.pop() pos.pop pos pop ans.append([tmp, a]) ans.append ans append [tmp, a] tmp a tmp -= a tmp a neg.append(tmp) neg.append neg append tmp tmp = pos[0] tmp pos[0] pos 0 for i in neg:
    ans.append([tmp, i])
    tmp -= i i neg ans.append([tmp, i]) ans.append ans append [tmp, i] tmp i tmp -= i tmp i print(tmp) print tmp print(*i) for i in ans for i in ans i ans for i in ans print(*i) print *i i [print(*i) for i in ans] ans = [] [] ans tmp -= neg[i] neg[i] tmp tmp -= a a tmp a = list(map(int , input().split())) list(map(int , input().split())) a pos = sorted([i for i in a if i >= 0], reverse=True) sorted([i for i in a if i >= 0], reverse=True) pos tmp -= i i tmp neg = sorted([i for i in a if i < 0], reverse=True) sorted([i for i in a if i < 0], reverse=True) neg tmp = neg.pop() neg.pop() tmp tmp = pos[0] pos[0] tmp tmp = neg[0] neg[0] tmp n = int(input()) int(input()) n a = pos.pop() pos.pop() a
n = int(input())
a = list(map(int , input().split()))
pos = sorted([i for i in a if i >= 0], reverse=True)
neg = sorted([i for i in a if i < 0], reverse=True)

ans = []
if len(neg) == 0 and len(pos) == 2:
    print(pos[0] - pos[1])
    print(pos[0], pos[1])
    exit()
elif len(pos) == 0:
    tmp = neg[0]
    for i in range(1,len(neg)):
        ans.append([tmp, neg[i]])
        tmp -= neg[i]
    print(tmp)
    [print(*i) for i in ans]
    exit()
elif len(neg) == 0:
    neg.append(pos.pop())

tmp = neg.pop()
while len(pos) > 1:
    a = pos.pop()
    ans.append([tmp, a])
    tmp -= a
neg.append(tmp)

tmp = pos[0]
for i in neg:
    ans.append([tmp, i])
    tmp -= i

print(tmp)
[print(*i) for i in ans]
