n = int(input())
data = list(map(int, input().split()))
data.sort()
#全て正の時の処理
if data[0] > 0:
    print(sum(data) - data[0] * 2)
    k = data[0]
    for i in range(1,n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
    print("{} {}".format(data[-1], k))
#すべて負の場合の処理
elif data[-1] <= 0:
    print(-sum(data) + (data[-1] * 2))
    k = data[-1]
    for i in range(n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
#それ以外
else: 
    print(sum(list(map(lambda x:abs(x), data))))
    max_data = data[-1]
    min_data = data[0]
    i = 1
    while data[i] <= 0:
        print("{} {}".format(max_data,data[i]))
        max_data -= data[i]
        i += 1
    while i < n - 1:
        print("{} {}".format(min_data, data[i]))
        min_data -= data[i]
        i += 1
    print("{} {}".format(max_data, min_data))


    

 n = int(input()) n int(input()) int input() input data = list(map(int, input().split())) data list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split data.sort() data.sort data sort if data[0] > 0:
    print(sum(data) - data[0] * 2)
    k = data[0]
    for i in range(1,n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
    print("{} {}".format(data[-1], k))
#すべて負の場合の処理
elif data[-1] <= 0:
    print(-sum(data) + (data[-1] * 2))
    k = data[-1]
    for i in range(n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
#それ以外
else: 
    print(sum(list(map(lambda x:abs(x), data))))
    max_data = data[-1]
    min_data = data[0]
    i = 1
    while data[i] <= 0:
        print("{} {}".format(max_data,data[i]))
        max_data -= data[i]
        i += 1
    while i < n - 1:
        print("{} {}".format(min_data, data[i]))
        min_data -= data[i]
        i += 1
    print("{} {}".format(max_data, min_data))


     data[0] > 0 data[0] data 0 0 print(sum(data) - data[0] * 2) print sum(data) - data[0] * 2 sum(data) sum data data[0] * 2 data[0] data 0 2 k = data[0] k data[0] data 0 for i in range(1,n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
     i range(1,n - 1) range 1 n - 1 n 1 print("{} {}".format(k, data[i])) print "{} {}".format(k, data[i]) "{} {}".format "{} {}" format k data[i] data i k -= data[i] k data[i] data i print("{} {}".format(data[-1], k)) print "{} {}".format(data[-1], k) "{} {}".format "{} {}" format data[-1] data -1 k elif data[-1] <= 0:
    print(-sum(data) + (data[-1] * 2))
    k = data[-1]
    for i in range(n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
#それ以外 data[-1] <= 0 data[-1] data -1 0 print(-sum(data) + (data[-1] * 2)) print -sum(data) + (data[-1] * 2) -sum(data) sum(data) sum data data[-1] * 2 data[-1] data -1 2 k = data[-1] k data[-1] data -1 for i in range(n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
#それ以外 i range(n - 1) range n - 1 n 1 print("{} {}".format(k, data[i])) print "{} {}".format(k, data[i]) "{} {}".format "{} {}" format k data[i] data i k -= data[i] k data[i] data i print(sum(list(map(lambda x:abs(x), data)))) print sum(list(map(lambda x:abs(x), data))) sum list(map(lambda x:abs(x), data)) list map(lambda x:abs(x), data) map lambda x:abs(x) abs(x) abs x x data max_data = data[-1] max_data data[-1] data -1 min_data = data[0] min_data data[0] data 0 i = 1 i 1 while data[i] <= 0:
        print("{} {}".format(max_data,data[i]))
        max_data -= data[i]
        i += 1
     data[i] <= 0 data[i] data i 0 print("{} {}".format(max_data,data[i])) print "{} {}".format(max_data,data[i]) "{} {}".format "{} {}" format max_data data[i] data i max_data -= data[i] max_data data[i] data i i += 1 i 1 while i < n - 1:
        print("{} {}".format(min_data, data[i]))
        min_data -= data[i]
        i += 1
     i < n - 1 i n - 1 n 1 print("{} {}".format(min_data, data[i])) print "{} {}".format(min_data, data[i]) "{} {}".format "{} {}" format min_data data[i] data i min_data -= data[i] min_data data[i] data i i += 1 i 1 print("{} {}".format(max_data, min_data)) print "{} {}".format(max_data, min_data) "{} {}".format "{} {}" format max_data min_data n = int(input()) int(input()) n max_data -= data[i] data[i] max_data k = data[-1] data[-1] k data = list(map(int, input().split())) list(map(int, input().split())) data min_data = data[0] data[0] min_data k -= data[i] data[i] k min_data -= data[i] data[i] min_data k = data[0] data[0] k k -= data[i] data[i] k max_data = data[-1] data[-1] max_data i += 1 1 i i += 1 1 i i = 1 1 i
n = int(input())
data = list(map(int, input().split()))
data.sort()
#全て正の時の処理
if data[0] > 0:
    print(sum(data) - data[0] * 2)
    k = data[0]
    for i in range(1,n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
    print("{} {}".format(data[-1], k))
#すべて負の場合の処理
elif data[-1] <= 0:
    print(-sum(data) + (data[-1] * 2))
    k = data[-1]
    for i in range(n - 1):
        print("{} {}".format(k, data[i]))
        k -= data[i]
#それ以外
else: 
    print(sum(list(map(lambda x:abs(x), data))))
    max_data = data[-1]
    min_data = data[0]
    i = 1
    while data[i] <= 0:
        print("{} {}".format(max_data,data[i]))
        max_data -= data[i]
        i += 1
    while i < n - 1:
        print("{} {}".format(min_data, data[i]))
        min_data -= data[i]
        i += 1
    print("{} {}".format(max_data, min_data))


    


