from bisect import bisect_left



N = int(eval(input()))

a = tuple(sorted(map(int, input().split())))



cnt = bisect_left(a, 0)  # 正の開始点==負の個数



if cnt <= 1:

    print((sum(a) - 2 * a[0]))

    t = a[0]

    for i in range(1, N - 1):

        print((t, a[i]))

        t -= a[i]

    print((a[-1], t))



else:

    # cnt-1個は正最大に連結

    if cnt == N:

        print((sum(map(abs, a)) + 2 * a[-1]))

        t = a[-1]

        for i in range(N - 1):

            print((t, a[i]))

            t -= a[i]



    else:

        print((sum(map(abs, a))))

        t = a[-1]

        for i in range(cnt - 1):

            print((t, a[i]))

            t -= a[i]

        s = a[cnt - 1]

        for i in range(cnt, N - 1):

            print((s, a[i]))

            s -= a[i]

        print((t, s))

N = int(eval(input()))

a = tuple(sorted(map(int, input().split())))



ans = []

res = 0

m = a[0]  # 最後に引く側

p = a[-1]  # 最後に足す側

for aa in a[1:N - 1]:

    if aa < 0:

        res -= aa

        ans.append((p, aa))

        p -= aa

    else:

        res += aa

        ans.append((m, aa))

        m -= aa

ans.append((p, m))



res += a[-1] - a[0]

print(res)

for aa in ans:

    print((*aa))

from bisect import bisect_left

N = int(eval(input()))
a = tuple(sorted(map(int, input().split())))
cnt = bisect_left(a, 0)  # 正の開始点==負の個数
if cnt <= 1:
    print((sum(a) - 2 * a[0]))
    t = a[0]
    for i in range(1, N - 1):
        print((t, a[i]))
        t -= a[i]
    print((a[-1], t))
else:
    # cnt-1個は正最大に連結
    if cnt == N:
        print((sum(map(abs, a)) + 2 * a[-1]))
        t = a[-1]
        for i in range(N - 1):
            print((t, a[i]))
            t -= a[i]
    else:
        print((sum(map(abs, a))))
        t = a[-1]
        for i in range(cnt - 1):
            print((t, a[i]))
            t -= a[i]
        s = a[cnt - 1]
        for i in range(cnt, N - 1):
            print((s, a[i]))
            s -= a[i]
        print((t, s))

N = int(eval(input()))
a = tuple(sorted(map(int, input().split())))
ans = []
res = 0
m = a[0]  # 最後に引く側
p = a[-1]  # 最後に足す側
for aa in a[1 : N - 1]:
    if aa < 0:
        res -= aa
        ans.append((p, aa))
        p -= aa
    else:
        res += aa
        ans.append((m, aa))
        m -= aa
ans.append((p, m))
res += a[-1] - a[0]
print(res)
for aa in ans:
    print((*aa))

-from bisect import bisect_left - -cnt = bisect_left(a, 0)  # 正の開始点==負の個数 -if cnt <= 1: -    print((sum(a) - 2 * a[0])) -    t = a[0] -    for i in range(1, N - 1): -        print((t, a[i])) -        t -= a[i] -    print((a[-1], t)) -else: -    # cnt-1個は正最大に連結 -    if cnt == N: -        print((sum(map(abs, a)) + 2 * a[-1])) -        t = a[-1] -        for i in range(N - 1): -            print((t, a[i])) -            t -= a[i] +ans = [] +res = 0 +m = a[0]  # 最後に引く側 +p = a[-1]  # 最後に足す側 +for aa in a[1 : N - 1]: +    if aa < 0: +        res -= aa +        ans.append((p, aa)) +        p -= aa -        print((sum(map(abs, a)))) -        t = a[-1] -        for i in range(cnt - 1): -            print((t, a[i])) -            t -= a[i] -        s = a[cnt - 1] -        for i in range(cnt, N - 1): -            print((s, a[i])) -            s -= a[i] -        print((t, s)) +        res += aa +        ans.append((m, aa)) +        m -= aa +ans.append((p, m)) +res += a[-1] - a[0] +print(res) +for aa in ans: +    print((*aa))