N = int(eval(input()))

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



AAA.sort()  # 昇順ソート



m = AAA[0]

M = AAA[N-1]

ANS = []



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

    if AAA[i] > 0:

        ANS.append((m, AAA[i]))

        m -= AAA[i]

        continue

    ANS.append((M, AAA[i]))

    M -= AAA[i]

ANS.append((M, m))



print((M-m))

for (x, y) in ANS:

    print((x, y))

N = int(eval(input()))

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



AAA.sort()



m = AAA[0]

M = AAA[N-1]



procedures = []

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

    if AAA[i] > 0:

        procedures.append((m, AAA[i]))

        m -= AAA[i]

    else:

        procedures.append((M, AAA[i]))

        M -= AAA[i]

procedures.append((M, m))



print((M-m))

for x, y in procedures:

    print((x, y))

N = int(eval(input()))
AAA = list(map(int, input().split()))
AAA.sort()  # 昇順ソート
m = AAA[0]
M = AAA[N - 1]
ANS = []
for i in range(1, N - 1):
    if AAA[i] > 0:
        ANS.append((m, AAA[i]))
        m -= AAA[i]
        continue
    ANS.append((M, AAA[i]))
    M -= AAA[i]
ANS.append((M, m))
print((M - m))
for (x, y) in ANS:
    print((x, y))

N = int(eval(input()))
AAA = list(map(int, input().split()))
AAA.sort()
m = AAA[0]
M = AAA[N - 1]
procedures = []
for i in range(1, N - 1):
    if AAA[i] > 0:
        procedures.append((m, AAA[i]))
        m -= AAA[i]
    else:
        procedures.append((M, AAA[i]))
        M -= AAA[i]
procedures.append((M, m))
print((M - m))
for x, y in procedures:
    print((x, y))

-AAA.sort()  # 昇順ソート +AAA.sort() -ANS = [] +procedures = [] -        ANS.append((m, AAA[i])) +        procedures.append((m, AAA[i])) -        continue -    ANS.append((M, AAA[i])) -    M -= AAA[i] -ANS.append((M, m)) +    else: +        procedures.append((M, AAA[i])) +        M -= AAA[i] +procedures.append((M, m)) -for (x, y) in ANS: +for x, y in procedures: