N = int(eval(input()))

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



positive = 0

negative = 0



for a in A:

    if a > 0:

        positive += a

    else:

        negative += a



if positive == 0:  # 全部負

    # 一番大きい数から残りをすべて引く

    A.sort(reverse=True)

    now = A[0]

    ans = []

    for a in A[1:]:

        ans.append((now, a))

        now -= a

    print(now)

    for a in ans:

        print((*a))

elif negative == 0:  # 全部非負

    # 一番小さい数から引いて，最後に大きい数から引く

    A.sort()

    now = A[0]

    ans = []

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

        ans.append((now, a))

        now -= a

    ans.append((A[-1], now))

    now = A[-1] - now

    print(now)

    for a in ans:

        print((*a))

else:

    A.sort()

    neg = A[0]

    pos = A[-1]

    ans = []

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

        if a > 0:

            ans.append((neg, a))

            neg -= a

        else:

            ans.append((pos, a))

            pos -= a

    ans.append((pos, neg))

    print((pos - neg))

    for a in ans:

        print((*a))

N = int(eval(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(eval(input()))
A = list(map(int, input().split()))
positive = 0
negative = 0
for a in A:
    if a > 0:
        positive += a
    else:
        negative += a
if positive == 0:  # 全部負
    # 一番大きい数から残りをすべて引く
    A.sort(reverse=True)
    now = A[0]
    ans = []
    for a in A[1:]:
        ans.append((now, a))
        now -= a
    print(now)
    for a in ans:
        print((*a))
elif negative == 0:  # 全部非負
    # 一番小さい数から引いて，最後に大きい数から引く
    A.sort()
    now = A[0]
    ans = []
    for a in A[1 : N - 1]:
        ans.append((now, a))
        now -= a
    ans.append((A[-1], now))
    now = A[-1] - now
    print(now)
    for a in ans:
        print((*a))
else:
    A.sort()
    neg = A[0]
    pos = A[-1]
    ans = []
    for a in A[1 : N - 1]:
        if a > 0:
            ans.append((neg, a))
            neg -= a
        else:
            ans.append((pos, a))
            pos -= a
    ans.append((pos, neg))
    print((pos - neg))
    for a in ans:
        print((*a))

N = int(eval(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

-positive = 0 -negative = 0 -for a in A: -    if a > 0: -        positive += a -    else: -        negative += a -if positive == 0:  # 全部負 -    # 一番大きい数から残りをすべて引く -    A.sort(reverse=True) +A.sort() +if A[0] < 0 and A[-1] > 0: +    ans = 0 +    for a in A: +        ans += abs(a) +    print(ans) -    ans = [] -    for a in A[1:]: -        ans.append((now, a)) +    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)) -    print(now) -    for a in ans: -        print((*a)) -elif negative == 0:  # 全部非負 -    # 一番小さい数から引いて，最後に大きい数から引く -    A.sort() -    now = A[0] -    ans = [] -    for a in A[1 : N - 1]: -        ans.append((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)) -    ans.append((A[-1], now)) -    now = A[-1] - now -    print(now) -    for a in ans: -        print((*a)) -else: -    A.sort() -    neg = A[0] -    pos = A[-1] -    ans = [] -    for a in A[1 : N - 1]: -        if a > 0: -            ans.append((neg, a)) -            neg -= a -        else: -            ans.append((pos, a)) -            pos -= a -    ans.append((pos, neg)) -    print((pos - neg)) -    for a in ans: -        print((*a))