def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    # 何個符号反転できるか？
    # -> 1 ～ N - 1 個反転できる
    # N - 1個: (((v - w) - x) - y) - z
    # N - 2個: ((v - w) - x) - (y - z)
    # ...
    #     2個: (v - w) - ((x - y) - z)
    #     1個: v - (((w - x) - y) - z)
    neg_cnt = sum([1 for a in A if a < 0])
    M = 0
    proc = list()
    if neg_cnt == N:
        # 全部負：絶対値が一番小さいもの以外を全て符号反転
        A.sort(reverse=True)
        x = A[0]
        for y in A[1:]:
            proc.append((x, y))
            x -= y
        M = x
    elif neg_cnt == 0:
        # 全部非負：一番小さいものだけ符号反転
        A.sort()
        x = A[0]
        for y in A[1:-1]:
            proc.append((x, y))
            x -= y
        x, y = A[-1], x
        proc.append((x, y))
        M = x - y
    else:
        # k個が負（1 <= k <= N - 1）：負の値を全て符号反転
        A.sort()
        x = A[-1]
        for y in A[:neg_cnt-1]:
            proc.append((x, y))
            x -= y
        former = x
        x = A[neg_cnt-1]  # the last negative element
        for y in A[neg_cnt:-1]:
            proc.append((x, y))
            x -= y
        latter = x
        proc.append((former, latter))
        M = former - latter
    print(M)
    for p in proc:
        x, y = p
        print('{} {}'.format(x, y))


if __name__ == '__main__':
    main() def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    # 何個符号反転できるか？
    # -> 1 ～ N - 1 個反転できる
    # N - 1個: (((v - w) - x) - y) - z
    # N - 2個: ((v - w) - x) - (y - z)
    # ...
    #     2個: (v - w) - ((x - y) - z)
    #     1個: v - (((w - x) - y) - z)
    neg_cnt = sum([1 for a in A if a < 0])
    M = 0
    proc = list()
    if neg_cnt == N:
        # 全部負：絶対値が一番小さいもの以外を全て符号反転
        A.sort(reverse=True)
        x = A[0]
        for y in A[1:]:
            proc.append((x, y))
            x -= y
        M = x
    elif neg_cnt == 0:
        # 全部非負：一番小さいものだけ符号反転
        A.sort()
        x = A[0]
        for y in A[1:-1]:
            proc.append((x, y))
            x -= y
        x, y = A[-1], x
        proc.append((x, y))
        M = x - y
    else:
        # k個が負（1 <= k <= N - 1）：負の値を全て符号反転
        A.sort()
        x = A[-1]
        for y in A[:neg_cnt-1]:
            proc.append((x, y))
            x -= y
        former = x
        x = A[neg_cnt-1]  # the last negative element
        for y in A[neg_cnt:-1]:
            proc.append((x, y))
            x -= y
        latter = x
        proc.append((former, latter))
        M = former - latter
    print(M)
    for p in proc:
        x, y = p
        print('{} {}'.format(x, y)) 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 ' ' 1 for a in A if a < 0 for a in A if a < 0 a A a < 0 a 0 if a < 0 1 neg_cnt = sum([1 for a in A if a < 0]) neg_cnt sum([1 for a in A if a < 0]) sum [1 for a in A if a < 0] M = 0 M 0 proc = list() proc list() list if neg_cnt == N:
        # 全部負：絶対値が一番小さいもの以外を全て符号反転
        A.sort(reverse=True)
        x = A[0]
        for y in A[1:]:
            proc.append((x, y))
            x -= y
        M = x
    elif neg_cnt == 0:
        # 全部非負：一番小さいものだけ符号反転
        A.sort()
        x = A[0]
        for y in A[1:-1]:
            proc.append((x, y))
            x -= y
        x, y = A[-1], x
        proc.append((x, y))
        M = x - y
    else:
        # k個が負（1 <= k <= N - 1）：負の値を全て符号反転
        A.sort()
        x = A[-1]
        for y in A[:neg_cnt-1]:
            proc.append((x, y))
            x -= y
        former = x
        x = A[neg_cnt-1]  # the last negative element
        for y in A[neg_cnt:-1]:
            proc.append((x, y))
            x -= y
        latter = x
        proc.append((former, latter))
        M = former - latter
     neg_cnt == N neg_cnt N A.sort(reverse=True) A.sort A sort reverse=True reverse True x = A[0] x A[0] A 0 for y in A[1:]:
            proc.append((x, y))
            x -= y
         y A[1:] A 1: 1 proc.append((x, y)) proc.append proc append (x, y) x y x -= y x y M = x M x elif neg_cnt == 0:
        # 全部非負：一番小さいものだけ符号反転
        A.sort()
        x = A[0]
        for y in A[1:-1]:
            proc.append((x, y))
            x -= y
        x, y = A[-1], x
        proc.append((x, y))
        M = x - y
     neg_cnt == 0 neg_cnt 0 A.sort() A.sort A sort x = A[0] x A[0] A 0 for y in A[1:-1]:
            proc.append((x, y))
            x -= y
         y A[1:-1] A 1:-1 1 -1 proc.append((x, y)) proc.append proc append (x, y) x y x -= y x y x, y = A[-1], x x A[-1] A -1 y x proc.append((x, y)) proc.append proc append (x, y) x y M = x - y M x - y x y A.sort() A.sort A sort x = A[-1] x A[-1] A -1 for y in A[:neg_cnt-1]:
            proc.append((x, y))
            x -= y
         y A[:neg_cnt-1] A :neg_cnt-1 neg_cnt-1 neg_cnt 1 proc.append((x, y)) proc.append proc append (x, y) x y x -= y x y former = x former x x = A[neg_cnt-1] x A[neg_cnt-1] A neg_cnt-1 neg_cnt 1 for y in A[neg_cnt:-1]:
            proc.append((x, y))
            x -= y
         y A[neg_cnt:-1] A neg_cnt:-1 neg_cnt -1 proc.append((x, y)) proc.append proc append (x, y) x y x -= y x y latter = x latter x proc.append((former, latter)) proc.append proc append (former, latter) former latter M = former - latter M former - latter former latter print(M) print M for p in proc:
        x, y = p
        print('{} {}'.format(x, y)) p proc x, y = p x p y print('{} {}'.format(x, y)) print '{} {}'.format(x, y) '{} {}'.format '{} {}' format x y if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    # 何個符号反転できるか？
    # -> 1 ～ N - 1 個反転できる
    # N - 1個: (((v - w) - x) - y) - z
    # N - 2個: ((v - w) - x) - (y - z)
    # ...
    #     2個: (v - w) - ((x - y) - z)
    #     1個: v - (((w - x) - y) - z)
    neg_cnt = sum([1 for a in A if a < 0])
    M = 0
    proc = list()
    if neg_cnt == N:
        # 全部負：絶対値が一番小さいもの以外を全て符号反転
        A.sort(reverse=True)
        x = A[0]
        for y in A[1:]:
            proc.append((x, y))
            x -= y
        M = x
    elif neg_cnt == 0:
        # 全部非負：一番小さいものだけ符号反転
        A.sort()
        x = A[0]
        for y in A[1:-1]:
            proc.append((x, y))
            x -= y
        x, y = A[-1], x
        proc.append((x, y))
        M = x - y
    else:
        # k個が負（1 <= k <= N - 1）：負の値を全て符号反転
        A.sort()
        x = A[-1]
        for y in A[:neg_cnt-1]:
            proc.append((x, y))
            x -= y
        former = x
        x = A[neg_cnt-1]  # the last negative element
        for y in A[neg_cnt:-1]:
            proc.append((x, y))
            x -= y
        latter = x
        proc.append((former, latter))
        M = former - latter
    print(M)
    for p in proc:
        x, y = p
        print('{} {}'.format(x, y)) def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    # 何個符号反転できるか？
    # -> 1 ～ N - 1 個反転できる
    # N - 1個: (((v - w) - x) - y) - z
    # N - 2個: ((v - w) - x) - (y - z)
    # ...
    #     2個: (v - w) - ((x - y) - z)
    #     1個: v - (((w - x) - y) - z)
    neg_cnt = sum([1 for a in A if a < 0])
    M = 0
    proc = list()
    if neg_cnt == N:
        # 全部負：絶対値が一番小さいもの以外を全て符号反転
        A.sort(reverse=True)
        x = A[0]
        for y in A[1:]:
            proc.append((x, y))
            x -= y
        M = x
    elif neg_cnt == 0:
        # 全部非負：一番小さいものだけ符号反転
        A.sort()
        x = A[0]
        for y in A[1:-1]:
            proc.append((x, y))
            x -= y
        x, y = A[-1], x
        proc.append((x, y))
        M = x - y
    else:
        # k個が負（1 <= k <= N - 1）：負の値を全て符号反転
        A.sort()
        x = A[-1]
        for y in A[:neg_cnt-1]:
            proc.append((x, y))
            x -= y
        former = x
        x = A[neg_cnt-1]  # the last negative element
        for y in A[neg_cnt:-1]:
            proc.append((x, y))
            x -= y
        latter = x
        proc.append((former, latter))
        M = former - latter
    print(M)
    for p in proc:
        x, y = p
        print('{} {}'.format(x, y)) main
def main():
    N = int(input())
    A = list(map(int, input().split(' ')))
    # 何個符号反転できるか？
    # -> 1 ～ N - 1 個反転できる
    # N - 1個: (((v - w) - x) - y) - z
    # N - 2個: ((v - w) - x) - (y - z)
    # ...
    #     2個: (v - w) - ((x - y) - z)
    #     1個: v - (((w - x) - y) - z)
    neg_cnt = sum([1 for a in A if a < 0])
    M = 0
    proc = list()
    if neg_cnt == N:
        # 全部負：絶対値が一番小さいもの以外を全て符号反転
        A.sort(reverse=True)
        x = A[0]
        for y in A[1:]:
            proc.append((x, y))
            x -= y
        M = x
    elif neg_cnt == 0:
        # 全部非負：一番小さいものだけ符号反転
        A.sort()
        x = A[0]
        for y in A[1:-1]:
            proc.append((x, y))
            x -= y
        x, y = A[-1], x
        proc.append((x, y))
        M = x - y
    else:
        # k個が負（1 <= k <= N - 1）：負の値を全て符号反転
        A.sort()
        x = A[-1]
        for y in A[:neg_cnt-1]:
            proc.append((x, y))
            x -= y
        former = x
        x = A[neg_cnt-1]  # the last negative element
        for y in A[neg_cnt:-1]:
            proc.append((x, y))
            x -= y
        latter = x
        proc.append((former, latter))
        M = former - latter
    print(M)
    for p in proc:
        x, y = p
        print('{} {}'.format(x, y))


if __name__ == '__main__':
    main()