There are N integers, A_1, A_2, ..., A_N, written on a blackboard.  We will repeat the following operation N-1 times so that we have only one integer on the blackboard.    * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.  Find the maximum possible value of the final integer on the blackboard and a sequence of operations that maximizes the final integer.
N = int(input())
inputs = sorted([int(i) for i in input().split()], reverse=True)

ans = inputs[-1]
for i in range(N-1, 1, -1):
    ans -= inputs[i-1]
print(inputs[0] - ans)

tmp = inputs[-1]
for i in range(N-1, 0, -1):
    print(tmp, inputs[i-1])
    tmp -= inputs[i-1]

N = int(input())
inputs = sorted([int(i) for i in input().split()])

min_value = inputs[0]
max_value = inputs[-1]
process = []
for i in range(1, N-1):
    value = inputs[i]
    if value >= 0:
        process.append([min_value, value])
        min_value -= value
    elif value < 0:
        process.append([max_value, value])
        max_value -= value
process.append([max_value, min_value])

print(max_value - min_value)
for item in process:
    print(item[0], item[1])
