n = int(input())
a = list(map(int, input().split()))

a.sort()
if a[0] * a[-1] <= 0:
    total = 0
    for i in a:
        total += abs(i)
    print(total)
    now = a[-1]
    for i in range(0, n - 2):
        if a[i + 1] > 0:
            print(min(a[i], now), max(a[i], now))
            now = -1 * abs(a[i] - now)
        else:
            print(now, a[i])
            now -= a[i]
    if a[-2] > 0:
        print(a[-2], now)
    else:
        print(now, a[-2])

elif a[0] > 0:
    total = sum(a) - 2 * a[0]
    print(total)
    now = a[0]
    for i in range(1, n - 1):
        print(now, a[i])
        now -= a[i]
    print(a[-1], now)

else:
    total = -1 * sum(a) + 2 * a[-1]
    print(total)
    now = a[n - 1]
    for i in range(n - 2, -1, -1):
        print(now, a[i])
        now -= a[i] 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] * a[-1] <= 0:
    total = 0
    for i in a:
        total += abs(i)
    print(total)
    now = a[-1]
    for i in range(0, n - 2):
        if a[i + 1] > 0:
            print(min(a[i], now), max(a[i], now))
            now = -1 * abs(a[i] - now)
        else:
            print(now, a[i])
            now -= a[i]
    if a[-2] > 0:
        print(a[-2], now)
    else:
        print(now, a[-2])

elif a[0] > 0:
    total = sum(a) - 2 * a[0]
    print(total)
    now = a[0]
    for i in range(1, n - 1):
        print(now, a[i])
        now -= a[i]
    print(a[-1], now)

else:
    total = -1 * sum(a) + 2 * a[-1]
    print(total)
    now = a[n - 1]
    for i in range(n - 2, -1, -1):
        print(now, a[i])
        now -= a[i] a[0] * a[-1] <= 0 a[0] * a[-1] a[0] a 0 a[-1] a -1 0 total = 0 total 0 for i in a:
        total += abs(i)
     i a total += abs(i) total abs(i) abs i print(total) print total now = a[-1] now a[-1] a -1 for i in range(0, n - 2):
        if a[i + 1] > 0:
            print(min(a[i], now), max(a[i], now))
            now = -1 * abs(a[i] - now)
        else:
            print(now, a[i])
            now -= a[i]
     i range(0, n - 2) range 0 n - 2 n 2 if a[i + 1] > 0:
            print(min(a[i], now), max(a[i], now))
            now = -1 * abs(a[i] - now)
        else:
            print(now, a[i])
            now -= a[i]
     a[i + 1] > 0 a[i + 1] a i + 1 i 1 0 print(min(a[i], now), max(a[i], now)) print min(a[i], now) min a[i] a i now max(a[i], now) max a[i] a i now now = -1 * abs(a[i] - now) now -1 * abs(a[i] - now) -1 abs(a[i] - now) abs a[i] - now a[i] a i now print(now, a[i]) print now a[i] a i now -= a[i] now a[i] a i if a[-2] > 0:
        print(a[-2], now)
    else:
        print(now, a[-2]) a[-2] > 0 a[-2] a -2 0 print(a[-2], now) print a[-2] a -2 now print(now, a[-2]) print now a[-2] a -2 elif a[0] > 0:
    total = sum(a) - 2 * a[0]
    print(total)
    now = a[0]
    for i in range(1, n - 1):
        print(now, a[i])
        now -= a[i]
    print(a[-1], now) a[0] > 0 a[0] a 0 0 total = sum(a) - 2 * a[0] total sum(a) - 2 * a[0] sum(a) sum a 2 * a[0] 2 a[0] a 0 print(total) print total now = a[0] now a[0] a 0 for i in range(1, n - 1):
        print(now, a[i])
        now -= a[i]
     i range(1, n - 1) range 1 n - 1 n 1 print(now, a[i]) print now a[i] a i now -= a[i] now a[i] a i print(a[-1], now) print a[-1] a -1 now total = -1 * sum(a) + 2 * a[-1] total -1 * sum(a) + 2 * a[-1] -1 * sum(a) -1 sum(a) sum a 2 * a[-1] 2 a[-1] a -1 print(total) print total now = a[n - 1] now a[n - 1] a n - 1 n 1 for i in range(n - 2, -1, -1):
        print(now, a[i])
        now -= a[i] i range(n - 2, -1, -1) range n - 2 n 2 -1 -1 print(now, a[i]) print now a[i] a i now -= a[i] now a[i] a i now = a[-1] a[-1] now total = sum(a) - 2 * a[0] sum(a) - 2 * a[0] total now = -1 * abs(a[i] - now) -1 * abs(a[i] - now) now total = -1 * sum(a) + 2 * a[-1] -1 * sum(a) + 2 * a[-1] total n = int(input()) int(input()) n total += abs(i) abs(i) total now = a[n - 1] a[n - 1] now now -= a[i] a[i] now now = a[0] a[0] now now -= a[i] a[i] now now -= a[i] a[i] now a = list(map(int, input().split())) list(map(int, input().split())) a total = 0 0 total
n = int(input())
a = list(map(int, input().split()))

a.sort()
if a[0] * a[-1] <= 0:
    total = 0
    for i in a:
        total += abs(i)
    print(total)
    now = a[-1]
    for i in range(0, n - 2):
        if a[i + 1] > 0:
            print(min(a[i], now), max(a[i], now))
            now = -1 * abs(a[i] - now)
        else:
            print(now, a[i])
            now -= a[i]
    if a[-2] > 0:
        print(a[-2], now)
    else:
        print(now, a[-2])

elif a[0] > 0:
    total = sum(a) - 2 * a[0]
    print(total)
    now = a[0]
    for i in range(1, n - 1):
        print(now, a[i])
        now -= a[i]
    print(a[-1], now)

else:
    total = -1 * sum(a) + 2 * a[-1]
    print(total)
    now = a[n - 1]
    for i in range(n - 2, -1, -1):
        print(now, a[i])
        now -= a[i]
