N = int(input())
a = list(map(int, input().split(' ')))
a.sort(reverse=True)

process = []
p_seed = a.pop(0)
n_seed = a.pop(-1)
for e in a:
    if e >= 0:
        process.append((n_seed, e))
        n_seed -= e
    else:
        process.append((p_seed, e))
        p_seed -= e
process.append((p_seed, n_seed))
m = p_seed - n_seed
print(m)
for x, y in process:
    print(str(x) + ' ' + str(y)) 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 ' ' a.sort(reverse=True) a.sort a sort reverse=True reverse True process = [] process [] p_seed = a.pop(0) p_seed a.pop(0) a.pop a pop 0 n_seed = a.pop(-1) n_seed a.pop(-1) a.pop a pop -1 for e in a:
    if e >= 0:
        process.append((n_seed, e))
        n_seed -= e
    else:
        process.append((p_seed, e))
        p_seed -= e e a if e >= 0:
        process.append((n_seed, e))
        n_seed -= e
    else:
        process.append((p_seed, e))
        p_seed -= e e >= 0 e 0 process.append((n_seed, e)) process.append process append (n_seed, e) n_seed e n_seed -= e n_seed e process.append((p_seed, e)) process.append process append (p_seed, e) p_seed e p_seed -= e p_seed e process.append((p_seed, n_seed)) process.append process append (p_seed, n_seed) p_seed n_seed m = p_seed - n_seed m p_seed - n_seed p_seed n_seed print(m) print m for x, y in process:
    print(str(x) + ' ' + str(y)) x y process print(str(x) + ' ' + str(y)) print str(x) + ' ' + str(y) str(x) + ' ' str(x) str x ' ' str(y) str y process = [] [] process n_seed = a.pop(-1) a.pop(-1) n_seed m = p_seed - n_seed p_seed - n_seed m p_seed -= e e p_seed p_seed = a.pop(0) a.pop(0) p_seed N = int(input()) int(input()) N n_seed -= e e n_seed a = list(map(int, input().split(' '))) list(map(int, input().split(' '))) a
N = int(input())
a = list(map(int, input().split(' ')))
a.sort(reverse=True)

process = []
p_seed = a.pop(0)
n_seed = a.pop(-1)
for e in a:
    if e >= 0:
        process.append((n_seed, e))
        n_seed -= e
    else:
        process.append((p_seed, e))
        p_seed -= e
process.append((p_seed, n_seed))
m = p_seed - n_seed
print(m)
for x, y in process:
    print(str(x) + ' ' + str(y))
