import bisect
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
point = bisect.bisect_right(a, 0)
a_minus = a[:point]
a_plus = a[point:]
len_plus = len(a_plus)
if (len(a_minus) > 0) & (len(a_plus) > 0):
    ans = sum(a_plus) - sum(a_minus)
    print(ans)
    for i in range(len(a_plus)):
        if len_plus == 1:
            x = a_plus.pop(0)
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif (i == 0):
            x = a_minus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 1:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
    for j in range(len(a_minus)):
        x = x - y
        y = a_minus.pop(0)
        print(str(x) + ' ' + str(y))
elif len(a_plus) > 0:
    ans = sum(a_plus) - ((a[0]) * 2)
    print(ans)
    for i in range(len(a_plus) - 1):
        if i == 0:
            x = a_plus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
elif len(a_minus) > 0:
    ans = (a_minus[-1] * 2) - sum(a_minus)
    print(ans)
    for i in range(len(a_minus) - 1):
        if i == 0:
            x = a_minus[-1]
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y)) import bisect bisect n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a = [int(i) for i in input().split()] a [int(i) for i in input().split()] a.sort() a.sort a sort point = bisect.bisect_right(a, 0) point bisect.bisect_right(a, 0) bisect.bisect_right bisect bisect_right a 0 a_minus = a[:point] a_minus a[:point] a :point point a_plus = a[point:] a_plus a[point:] a point: point len_plus = len(a_plus) len_plus len(a_plus) len a_plus if (len(a_minus) > 0) & (len(a_plus) > 0):
    ans = sum(a_plus) - sum(a_minus)
    print(ans)
    for i in range(len(a_plus)):
        if len_plus == 1:
            x = a_plus.pop(0)
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif (i == 0):
            x = a_minus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 1:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
    for j in range(len(a_minus)):
        x = x - y
        y = a_minus.pop(0)
        print(str(x) + ' ' + str(y))
elif len(a_plus) > 0:
    ans = sum(a_plus) - ((a[0]) * 2)
    print(ans)
    for i in range(len(a_plus) - 1):
        if i == 0:
            x = a_plus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
elif len(a_minus) > 0:
    ans = (a_minus[-1] * 2) - sum(a_minus)
    print(ans)
    for i in range(len(a_minus) - 1):
        if i == 0:
            x = a_minus[-1]
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y)) (len(a_minus) > 0) & (len(a_plus) > 0) len(a_minus) > 0 len(a_minus) len a_minus 0 len(a_plus) > 0 len(a_plus) len a_plus 0 ans = sum(a_plus) - sum(a_minus) ans sum(a_plus) - sum(a_minus) sum(a_plus) sum a_plus sum(a_minus) sum a_minus print(ans) print ans for i in range(len(a_plus)):
        if len_plus == 1:
            x = a_plus.pop(0)
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif (i == 0):
            x = a_minus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 1:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
     i range(len(a_plus)) range len(a_plus) len a_plus if len_plus == 1:
            x = a_plus.pop(0)
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif (i == 0):
            x = a_minus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 1:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
     len_plus == 1 len_plus 1 x = a_plus.pop(0) x a_plus.pop(0) a_plus.pop a_plus pop 0 y = a_minus.pop(0) y a_minus.pop(0) a_minus.pop a_minus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y elif (i == 0):
            x = a_minus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
         i == 0 i 0 x = a_minus.pop(0) x a_minus.pop(0) a_minus.pop a_minus pop 0 y = a_plus.pop(0) y a_plus.pop(0) a_plus.pop a_plus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y elif i == len_plus - 1:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
         i == len_plus - 1 i len_plus - 1 len_plus 1 y = x - y y x - y x y x = a_plus.pop(0) x a_plus.pop(0) a_plus.pop a_plus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y x = x - y x x - y x y y = a_plus.pop(0) y a_plus.pop(0) a_plus.pop a_plus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y for j in range(len(a_minus)):
        x = x - y
        y = a_minus.pop(0)
        print(str(x) + ' ' + str(y)) j range(len(a_minus)) range len(a_minus) len a_minus x = x - y x x - y x y y = a_minus.pop(0) y a_minus.pop(0) a_minus.pop a_minus pop 0 print(str(x) + ' ' + str(y)) print str(x) + ' ' + str(y) str(x) + ' ' str(x) str x ' ' str(y) str y elif len(a_plus) > 0:
    ans = sum(a_plus) - ((a[0]) * 2)
    print(ans)
    for i in range(len(a_plus) - 1):
        if i == 0:
            x = a_plus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y)) len(a_plus) > 0 len(a_plus) len a_plus 0 ans = sum(a_plus) - ((a[0]) * 2) ans sum(a_plus) - ((a[0]) * 2) sum(a_plus) sum a_plus (a[0]) * 2 a[0] a 0 2 print(ans) print ans for i in range(len(a_plus) - 1):
        if i == 0:
            x = a_plus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y)) i range(len(a_plus) - 1) range len(a_plus) - 1 len(a_plus) len a_plus 1 if i == 0:
            x = a_plus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y)) i == 0 i 0 x = a_plus.pop(0) x a_plus.pop(0) a_plus.pop a_plus pop 0 y = a_plus.pop(0) y a_plus.pop(0) a_plus.pop a_plus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y elif i == len_plus - 2:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
         i == len_plus - 2 i len_plus - 2 len_plus 2 y = x - y y x - y x y x = a_plus.pop(0) x a_plus.pop(0) a_plus.pop a_plus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y x = x - y x x - y x y y = a_plus.pop(0) y a_plus.pop(0) a_plus.pop a_plus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y elif len(a_minus) > 0:
    ans = (a_minus[-1] * 2) - sum(a_minus)
    print(ans)
    for i in range(len(a_minus) - 1):
        if i == 0:
            x = a_minus[-1]
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y)) len(a_minus) > 0 len(a_minus) len a_minus 0 ans = (a_minus[-1] * 2) - sum(a_minus) ans (a_minus[-1] * 2) - sum(a_minus) a_minus[-1] * 2 a_minus[-1] a_minus -1 2 sum(a_minus) sum a_minus print(ans) print ans for i in range(len(a_minus) - 1):
        if i == 0:
            x = a_minus[-1]
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y)) i range(len(a_minus) - 1) range len(a_minus) - 1 len(a_minus) len a_minus 1 if i == 0:
            x = a_minus[-1]
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y)) i == 0 i 0 x = a_minus[-1] x a_minus[-1] a_minus -1 y = a_minus.pop(0) y a_minus.pop(0) a_minus.pop a_minus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y elif i == len_plus - 2:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
         i == len_plus - 2 i len_plus - 2 len_plus 2 x = x - y x x - y x y y = a_minus.pop(0) y a_minus.pop(0) a_minus.pop a_minus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y x = x - y x x - y x y y = a_minus.pop(0) y a_minus.pop(0) a_minus.pop a_minus pop 0 print(str(x) + " " + str(y)) print str(x) + " " + str(y) str(x) + " " str(x) str x " " str(y) str y x = a_plus.pop(0) a_plus.pop(0) x y = a_minus.pop(0) a_minus.pop(0) y y = a_plus.pop(0) a_plus.pop(0) y y = a_minus.pop(0) a_minus.pop(0) y a = [int(i) for i in input().split()] [int(i) for i in input().split()] a x = a_minus.pop(0) a_minus.pop(0) x x = a_plus.pop(0) a_plus.pop(0) x x = a_plus.pop(0) a_plus.pop(0) x a_plus = a[point:] a[point:] a_plus ans = sum(a_plus) - sum(a_minus) sum(a_plus) - sum(a_minus) ans x = a_plus.pop(0) a_plus.pop(0) x y = x - y x - y y x = x - y x - y x x = x - y x - y x x = a_minus[-1] a_minus[-1] x y = a_plus.pop(0) a_plus.pop(0) y y = a_minus.pop(0) a_minus.pop(0) y n = int(input()) int(input()) n y = a_minus.pop(0) a_minus.pop(0) y ans = (a_minus[-1] * 2) - sum(a_minus) (a_minus[-1] * 2) - sum(a_minus) ans x = x - y x - y x a_minus = a[:point] a[:point] a_minus y = a_plus.pop(0) a_plus.pop(0) y y = a_plus.pop(0) a_plus.pop(0) y point = bisect.bisect_right(a, 0) bisect.bisect_right(a, 0) point len_plus = len(a_plus) len(a_plus) len_plus x = x - y x - y x ans = sum(a_plus) - ((a[0]) * 2) sum(a_plus) - ((a[0]) * 2) ans y = x - y x - y y x = x - y x - y x y = a_minus.pop(0) a_minus.pop(0) y
import bisect
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
point = bisect.bisect_right(a, 0)
a_minus = a[:point]
a_plus = a[point:]
len_plus = len(a_plus)
if (len(a_minus) > 0) & (len(a_plus) > 0):
    ans = sum(a_plus) - sum(a_minus)
    print(ans)
    for i in range(len(a_plus)):
        if len_plus == 1:
            x = a_plus.pop(0)
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif (i == 0):
            x = a_minus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 1:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
    for j in range(len(a_minus)):
        x = x - y
        y = a_minus.pop(0)
        print(str(x) + ' ' + str(y))
elif len(a_plus) > 0:
    ans = sum(a_plus) - ((a[0]) * 2)
    print(ans)
    for i in range(len(a_plus) - 1):
        if i == 0:
            x = a_plus.pop(0)
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            y = x - y
            x = a_plus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_plus.pop(0)
            print(str(x) + " " + str(y))
elif len(a_minus) > 0:
    ans = (a_minus[-1] * 2) - sum(a_minus)
    print(ans)
    for i in range(len(a_minus) - 1):
        if i == 0:
            x = a_minus[-1]
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        elif i == len_plus - 2:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))
        else:
            x = x - y
            y = a_minus.pop(0)
            print(str(x) + " " + str(y))