N = int(input())
A = list(map(int, input().split()))
A.sort()

if A[0] < 0 and A[-1] > 0:
    ans = 0
    for a in A:
        ans += abs(a)
    print(ans)
    now = A[0]
    for a in A[1:N - 1]:
        if a >= 0:
            print(now, a)
            now -= a
    print(A[-1], now)
    now = A[-1] - now
    for a in A[1: -1]:
        if a < 0:
            print(now, a)
            now -= a
elif A[0] >= 0:
    ans = sum(A) - A[0] * 2
    print(ans)
    now = A[0]
    for a in A[1: -1]:
        print(now, a)
        now -= a
    print(A[-1], now)
else:
    ans = -sum(A) + A[-1] * 2
    print(ans)
    now = A[-1]
    for a in A[: -1]:
        print(now, a)
        now -= a 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 A.sort() A.sort A sort if A[0] < 0 and A[-1] > 0:
    ans = 0
    for a in A:
        ans += abs(a)
    print(ans)
    now = A[0]
    for a in A[1:N - 1]:
        if a >= 0:
            print(now, a)
            now -= a
    print(A[-1], now)
    now = A[-1] - now
    for a in A[1: -1]:
        if a < 0:
            print(now, a)
            now -= a
elif A[0] >= 0:
    ans = sum(A) - A[0] * 2
    print(ans)
    now = A[0]
    for a in A[1: -1]:
        print(now, a)
        now -= a
    print(A[-1], now)
else:
    ans = -sum(A) + A[-1] * 2
    print(ans)
    now = A[-1]
    for a in A[: -1]:
        print(now, a)
        now -= a A[0] < 0 and A[-1] > 0 A[0] < 0 A[0] A 0 0 A[-1] > 0 A[-1] A -1 0 ans = 0 ans 0 for a in A:
        ans += abs(a)
     a A ans += abs(a) ans abs(a) abs a print(ans) print ans now = A[0] now A[0] A 0 for a in A[1:N - 1]:
        if a >= 0:
            print(now, a)
            now -= a
     a A[1:N - 1] A 1:N - 1 1 N - 1 N 1 if a >= 0:
            print(now, a)
            now -= a
     a >= 0 a 0 print(now, a) print now a now -= a now a print(A[-1], now) print A[-1] A -1 now now = A[-1] - now now A[-1] - now A[-1] A -1 now for a in A[1: -1]:
        if a < 0:
            print(now, a)
            now -= a a A[1: -1] A 1: -1 1 -1 if a < 0:
            print(now, a)
            now -= a a < 0 a 0 print(now, a) print now a now -= a now a elif A[0] >= 0:
    ans = sum(A) - A[0] * 2
    print(ans)
    now = A[0]
    for a in A[1: -1]:
        print(now, a)
        now -= a
    print(A[-1], now) A[0] >= 0 A[0] A 0 0 ans = sum(A) - A[0] * 2 ans sum(A) - A[0] * 2 sum(A) sum A A[0] * 2 A[0] A 0 2 print(ans) print ans now = A[0] now A[0] A 0 for a in A[1: -1]:
        print(now, a)
        now -= a
     a A[1: -1] A 1: -1 1 -1 print(now, a) print now a now -= a now a print(A[-1], now) print A[-1] A -1 now ans = -sum(A) + A[-1] * 2 ans -sum(A) + A[-1] * 2 -sum(A) sum(A) sum A A[-1] * 2 A[-1] A -1 2 print(ans) print ans now = A[-1] now A[-1] A -1 for a in A[: -1]:
        print(now, a)
        now -= a a A[: -1] A : -1 -1 print(now, a) print now a now -= a now a ans += abs(a) abs(a) ans now -= a a now now -= a a now now = A[0] A[0] now now -= a a now ans = 0 0 ans A = list(map(int, input().split())) list(map(int, input().split())) A now -= a a now ans = -sum(A) + A[-1] * 2 -sum(A) + A[-1] * 2 ans ans = sum(A) - A[0] * 2 sum(A) - A[0] * 2 ans now = A[-1] A[-1] now now = A[-1] - now A[-1] - now now now = A[0] A[0] now N = int(input()) int(input()) N
N = int(input())
A = list(map(int, input().split()))
A.sort()

if A[0] < 0 and A[-1] > 0:
    ans = 0
    for a in A:
        ans += abs(a)
    print(ans)
    now = A[0]
    for a in A[1:N - 1]:
        if a >= 0:
            print(now, a)
            now -= a
    print(A[-1], now)
    now = A[-1] - now
    for a in A[1: -1]:
        if a < 0:
            print(now, a)
            now -= a
elif A[0] >= 0:
    ans = sum(A) - A[0] * 2
    print(ans)
    now = A[0]
    for a in A[1: -1]:
        print(now, a)
        now -= a
    print(A[-1], now)
else:
    ans = -sum(A) + A[-1] * 2
    print(ans)
    now = A[-1]
    for a in A[: -1]:
        print(now, a)
        now -= a