N = int(input())
A = sorted([int(i) for i in input().split()])

if max(A) < 0:
    print(max(A)-sum(A[:-1]))
    c = max(A)
    for i in range(N-1):
        print(c, A[i])
        c -= A[i]

elif min(A) >= 0:
    print(sum(A[1:])-min(A))
    c = min(A)
    for i in range(1, N-1):
        print(c, A[i])
        c -= A[i]
    print(max(A), c)

else:
    print(sum(abs(x) for x in A))
    c = min(A)
    d = max(A)
    for i in range(1, N-1):
        if A[i] < 0:
            print(d, A[i])
            d -= A[i]
        else:
            print(c, A[i])
            c -= A[i]
    print(d, c)
     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 = sorted([int(i) for i in input().split()]) A sorted([int(i) for i in input().split()]) sorted [int(i) for i in input().split()] if max(A) < 0:
    print(max(A)-sum(A[:-1]))
    c = max(A)
    for i in range(N-1):
        print(c, A[i])
        c -= A[i]

elif min(A) >= 0:
    print(sum(A[1:])-min(A))
    c = min(A)
    for i in range(1, N-1):
        print(c, A[i])
        c -= A[i]
    print(max(A), c)

else:
    print(sum(abs(x) for x in A))
    c = min(A)
    d = max(A)
    for i in range(1, N-1):
        if A[i] < 0:
            print(d, A[i])
            d -= A[i]
        else:
            print(c, A[i])
            c -= A[i]
    print(d, c)
     max(A) < 0 max(A) max A 0 print(max(A)-sum(A[:-1])) print max(A)-sum(A[:-1]) max(A) max A sum(A[:-1]) sum A[:-1] A :-1 -1 c = max(A) c max(A) max A for i in range(N-1):
        print(c, A[i])
        c -= A[i] i range(N-1) range N-1 N 1 print(c, A[i]) print c A[i] A i c -= A[i] c A[i] A i elif min(A) >= 0:
    print(sum(A[1:])-min(A))
    c = min(A)
    for i in range(1, N-1):
        print(c, A[i])
        c -= A[i]
    print(max(A), c) min(A) >= 0 min(A) min A 0 print(sum(A[1:])-min(A)) print sum(A[1:])-min(A) sum(A[1:]) sum A[1:] A 1: 1 min(A) min A c = min(A) c min(A) min A for i in range(1, N-1):
        print(c, A[i])
        c -= A[i]
     i range(1, N-1) range 1 N-1 N 1 print(c, A[i]) print c A[i] A i c -= A[i] c A[i] A i print(max(A), c) print max(A) max A c print(sum(abs(x) for x in A)) print sum(abs(x) for x in A) sum abs(x) abs x c = min(A) c min(A) min A d = max(A) d max(A) max A for i in range(1, N-1):
        if A[i] < 0:
            print(d, A[i])
            d -= A[i]
        else:
            print(c, A[i])
            c -= A[i]
     i range(1, N-1) range 1 N-1 N 1 if A[i] < 0:
            print(d, A[i])
            d -= A[i]
        else:
            print(c, A[i])
            c -= A[i]
     A[i] < 0 A[i] A i 0 print(d, A[i]) print d A[i] A i d -= A[i] d A[i] A i print(c, A[i]) print c A[i] A i c -= A[i] c A[i] A i print(d, c) print d c c = max(A) max(A) c c -= A[i] A[i] c N = int(input()) int(input()) N c = min(A) min(A) c A = sorted([int(i) for i in input().split()]) sorted([int(i) for i in input().split()]) A d -= A[i] A[i] d d = max(A) max(A) d c = min(A) min(A) c c -= A[i] A[i] c c -= A[i] A[i] c
N = int(input())
A = sorted([int(i) for i in input().split()])

if max(A) < 0:
    print(max(A)-sum(A[:-1]))
    c = max(A)
    for i in range(N-1):
        print(c, A[i])
        c -= A[i]

elif min(A) >= 0:
    print(sum(A[1:])-min(A))
    c = min(A)
    for i in range(1, N-1):
        print(c, A[i])
        c -= A[i]
    print(max(A), c)

else:
    print(sum(abs(x) for x in A))
    c = min(A)
    d = max(A)
    for i in range(1, N-1):
        if A[i] < 0:
            print(d, A[i])
            d -= A[i]
        else:
            print(c, A[i])
            c -= A[i]
    print(d, c)
    
