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]) N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i inputs = sorted([int(i) for i in input().split()]) inputs sorted([int(i) for i in input().split()]) sorted [int(i) for i in input().split()] min_value = inputs[0] min_value inputs[0] inputs 0 max_value = inputs[-1] max_value inputs[-1] inputs -1 process = [] 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 i range(1, N-1) range 1 N-1 N 1 value = inputs[i] value inputs[i] inputs i if value >= 0:
        process.append([min_value, value])
        min_value -= value
    elif value < 0:
        process.append([max_value, value])
        max_value -= value value >= 0 value 0 process.append([min_value, value]) process.append process append [min_value, value] min_value value min_value -= value min_value value elif value < 0:
        process.append([max_value, value])
        max_value -= value value < 0 value 0 process.append([max_value, value]) process.append process append [max_value, value] max_value value max_value -= value max_value value process.append([max_value, min_value]) process.append process append [max_value, min_value] max_value min_value print(max_value - min_value) print max_value - min_value max_value min_value for item in process:
    print(item[0], item[1]) item process print(item[0], item[1]) print item[0] item 0 item[1] item 1 min_value -= value value min_value max_value -= value value max_value min_value = inputs[0] inputs[0] min_value max_value = inputs[-1] inputs[-1] max_value process = [] [] process N = int(input()) int(input()) N inputs = sorted([int(i) for i in input().split()]) sorted([int(i) for i in input().split()]) inputs value = inputs[i] inputs[i] value
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])
