def main():
    n = int(input())
    a = list(map(int, input().split()))
    plus = []
    minus = []
    for i in a:
        if i > 0:
            plus.append(i)
        elif i < 0:
            minus.append(i)
        else:
            if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
    plus.sort(reverse=True)
    minus.sort()
    if len(minus) == 0:
        minus.append(plus.pop())
    elif len(plus) == 0:
        plus.append(minus.pop())
    print(sum(plus)-sum(minus))
    now = minus[-1]
    for i in range(len(plus) - 1):
        print(now, plus[i])
        now -= plus[i]
    print(plus[-1], now)
    now = plus[-1] - now
    for i in range(len(minus) - 1):
        print(now, minus[i])
        now -= minus[i]
main() def main():
    n = int(input())
    a = list(map(int, input().split()))
    plus = []
    minus = []
    for i in a:
        if i > 0:
            plus.append(i)
        elif i < 0:
            minus.append(i)
        else:
            if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
    plus.sort(reverse=True)
    minus.sort()
    if len(minus) == 0:
        minus.append(plus.pop())
    elif len(plus) == 0:
        plus.append(minus.pop())
    print(sum(plus)-sum(minus))
    now = minus[-1]
    for i in range(len(plus) - 1):
        print(now, plus[i])
        now -= plus[i]
    print(plus[-1], now)
    now = plus[-1] - now
    for i in range(len(minus) - 1):
        print(now, minus[i])
        now -= minus[i] main 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 = [] plus [] minus = [] minus [] for i in a:
        if i > 0:
            plus.append(i)
        elif i < 0:
            minus.append(i)
        else:
            if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
     i a if i > 0:
            plus.append(i)
        elif i < 0:
            minus.append(i)
        else:
            if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
     i > 0 i 0 plus.append(i) plus.append plus append i elif i < 0:
            minus.append(i)
         i < 0 i 0 minus.append(i) minus.append minus append i if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
     len(minus) == 0 len(minus) len minus 0 minus.append(i) minus.append minus append i plus.append(i) plus.append plus append i plus.sort(reverse=True) plus.sort plus sort reverse=True reverse True minus.sort() minus.sort minus sort if len(minus) == 0:
        minus.append(plus.pop())
    elif len(plus) == 0:
        plus.append(minus.pop())
     len(minus) == 0 len(minus) len minus 0 minus.append(plus.pop()) minus.append minus append plus.pop() plus.pop plus pop elif len(plus) == 0:
        plus.append(minus.pop())
     len(plus) == 0 len(plus) len plus 0 plus.append(minus.pop()) plus.append plus append minus.pop() minus.pop minus pop print(sum(plus)-sum(minus)) print sum(plus)-sum(minus) sum(plus) sum plus sum(minus) sum minus now = minus[-1] now minus[-1] minus -1 for i in range(len(plus) - 1):
        print(now, plus[i])
        now -= plus[i]
     i range(len(plus) - 1) range len(plus) - 1 len(plus) len plus 1 print(now, plus[i]) print now plus[i] plus i now -= plus[i] now plus[i] plus i print(plus[-1], now) print plus[-1] plus -1 now now = plus[-1] - now now plus[-1] - now plus[-1] plus -1 now for i in range(len(minus) - 1):
        print(now, minus[i])
        now -= minus[i] i range(len(minus) - 1) range len(minus) - 1 len(minus) len minus 1 print(now, minus[i]) print now minus[i] minus i now -= minus[i] now minus[i] minus i main() main def main():
    n = int(input())
    a = list(map(int, input().split()))
    plus = []
    minus = []
    for i in a:
        if i > 0:
            plus.append(i)
        elif i < 0:
            minus.append(i)
        else:
            if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
    plus.sort(reverse=True)
    minus.sort()
    if len(minus) == 0:
        minus.append(plus.pop())
    elif len(plus) == 0:
        plus.append(minus.pop())
    print(sum(plus)-sum(minus))
    now = minus[-1]
    for i in range(len(plus) - 1):
        print(now, plus[i])
        now -= plus[i]
    print(plus[-1], now)
    now = plus[-1] - now
    for i in range(len(minus) - 1):
        print(now, minus[i])
        now -= minus[i] def main():
    n = int(input())
    a = list(map(int, input().split()))
    plus = []
    minus = []
    for i in a:
        if i > 0:
            plus.append(i)
        elif i < 0:
            minus.append(i)
        else:
            if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
    plus.sort(reverse=True)
    minus.sort()
    if len(minus) == 0:
        minus.append(plus.pop())
    elif len(plus) == 0:
        plus.append(minus.pop())
    print(sum(plus)-sum(minus))
    now = minus[-1]
    for i in range(len(plus) - 1):
        print(now, plus[i])
        now -= plus[i]
    print(plus[-1], now)
    now = plus[-1] - now
    for i in range(len(minus) - 1):
        print(now, minus[i])
        now -= minus[i] main
def main():
    n = int(input())
    a = list(map(int, input().split()))
    plus = []
    minus = []
    for i in a:
        if i > 0:
            plus.append(i)
        elif i < 0:
            minus.append(i)
        else:
            if len(minus) == 0:
                minus.append(i)
            else:
                plus.append(i)
    plus.sort(reverse=True)
    minus.sort()
    if len(minus) == 0:
        minus.append(plus.pop())
    elif len(plus) == 0:
        plus.append(minus.pop())
    print(sum(plus)-sum(minus))
    now = minus[-1]
    for i in range(len(plus) - 1):
        print(now, plus[i])
        now -= plus[i]
    print(plus[-1], now)
    now = plus[-1] - now
    for i in range(len(minus) - 1):
        print(now, minus[i])
        now -= minus[i]
main()