n = int(input())
a = list(map(int, input().split()))
plus, minus = [], []
for x in a:
    if x < 0: minus.append(x)
    else: plus.append(x)

if plus and minus:
    print(sum(map(abs, a)))
    p = plus[0]
    for x in minus[1:]:
        print(p, x)
        p -= x
    
    m = minus[0]
    for x in plus[1:]:
        print(m, x)
        m -= x
    
    print(p, m)

if not plus:
    minus.sort(reverse=True)
    m = minus[0]
    print(-(sum(minus) - m * 2))
    for x in minus[1:]:
        print(m, x)
        m -= x

if not minus:
    plus.sort()
    p = plus[0]
    print(sum(plus) - p * 2)
    for x in plus[2:]:
        print(p, x)
        p -= x
    print(plus[1], p) 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 plus, minus = [], [] plus [] minus [] for x in a:
    if x < 0: minus.append(x)
    else: plus.append(x) x a if x < 0: minus.append(x)
    else: plus.append(x) x < 0 x 0 if plus and minus:
    print(sum(map(abs, a)))
    p = plus[0]
    for x in minus[1:]:
        print(p, x)
        p -= x
    
    m = minus[0]
    for x in plus[1:]:
        print(m, x)
        m -= x
    
    print(p, m) plus and minus plus minus print(sum(map(abs, a))) print sum(map(abs, a)) sum map(abs, a) map abs a p = plus[0] p plus[0] plus 0 for x in minus[1:]:
        print(p, x)
        p -= x
    
     x minus[1:] minus 1: 1 print(p, x) print p x p -= x p x m = minus[0] m minus[0] minus 0 for x in plus[1:]:
        print(m, x)
        m -= x
    
     x plus[1:] plus 1: 1 print(m, x) print m x m -= x m x print(p, m) print p m if not plus:
    minus.sort(reverse=True)
    m = minus[0]
    print(-(sum(minus) - m * 2))
    for x in minus[1:]:
        print(m, x)
        m -= x not plus plus minus.sort(reverse=True) minus.sort minus sort reverse=True reverse True m = minus[0] m minus[0] minus 0 print(-(sum(minus) - m * 2)) print -(sum(minus) - m * 2) sum(minus) - m * 2 sum(minus) sum minus m * 2 m 2 for x in minus[1:]:
        print(m, x)
        m -= x x minus[1:] minus 1: 1 print(m, x) print m x m -= x m x if not minus:
    plus.sort()
    p = plus[0]
    print(sum(plus) - p * 2)
    for x in plus[2:]:
        print(p, x)
        p -= x
    print(plus[1], p) not minus minus plus.sort() plus.sort plus sort p = plus[0] p plus[0] plus 0 print(sum(plus) - p * 2) print sum(plus) - p * 2 sum(plus) sum plus p * 2 p 2 for x in plus[2:]:
        print(p, x)
        p -= x
     x plus[2:] plus 2: 2 print(p, x) print p x p -= x p x print(plus[1], p) print plus[1] plus 1 p plus, minus = [], [] [] plus p -= x x p minus = [], [] [] minus m -= x x m n = int(input()) int(input()) n p -= x x p m = minus[0] minus[0] m m = minus[0] minus[0] m m -= x x m p = plus[0] plus[0] p p = plus[0] plus[0] p a = list(map(int, input().split())) list(map(int, input().split())) a
n = int(input())
a = list(map(int, input().split()))
plus, minus = [], []
for x in a:
    if x < 0: minus.append(x)
    else: plus.append(x)

if plus and minus:
    print(sum(map(abs, a)))
    p = plus[0]
    for x in minus[1:]:
        print(p, x)
        p -= x
    
    m = minus[0]
    for x in plus[1:]:
        print(m, x)
        m -= x
    
    print(p, m)

if not plus:
    minus.sort(reverse=True)
    m = minus[0]
    print(-(sum(minus) - m * 2))
    for x in minus[1:]:
        print(m, x)
        m -= x

if not minus:
    plus.sort()
    p = plus[0]
    print(sum(plus) - p * 2)
    for x in plus[2:]:
        print(p, x)
        p -= x
    print(plus[1], p)
