#!/usr/bin/env python3
#diverta C

N = int(input())
a = list(map(int,input().split()))
a.sort()
s = a[0]
l = a[-1]
log = []
for i in a[1:-1]:
    if i > 0:
        log += [(s, i)]
        s -= i
    else:
        log += [(l, i)]
        l -= i
log += [(l, s)]
print(l - s)
for i, j in log:
    print(i, j) 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() a.sort a sort s = a[0] s a[0] a 0 l = a[-1] l a[-1] a -1 log = [] log [] for i in a[1:-1]:
    if i > 0:
        log += [(s, i)]
        s -= i
    else:
        log += [(l, i)]
        l -= i i a[1:-1] a 1:-1 1 -1 if i > 0:
        log += [(s, i)]
        s -= i
    else:
        log += [(l, i)]
        l -= i i > 0 i 0 log += [(s, i)] log [(s, i)] (s, i) s i s -= i s i log += [(l, i)] log [(l, i)] (l, i) l i l -= i l i log += [(l, s)] log [(l, s)] (l, s) l s print(l - s) print l - s l s for i, j in log:
    print(i, j) i j log print(i, j) print i j s -= i i s log += [(l, s)] [(l, s)] log log += [(l, i)] [(l, i)] log log = [] [] log s = a[0] a[0] s l -= i i l log += [(s, i)] [(s, i)] log a = list(map(int,input().split())) list(map(int,input().split())) a l = a[-1] a[-1] l N = int(input()) int(input()) N
#!/usr/bin/env python3
#diverta C

N = int(input())
a = list(map(int,input().split()))
a.sort()
s = a[0]
l = a[-1]
log = []
for i in a[1:-1]:
    if i > 0:
        log += [(s, i)]
        s -= i
    else:
        log += [(l, i)]
        l -= i
log += [(l, s)]
print(l - s)
for i, j in log:
    print(i, j)