n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a_left, a_right = a[0], a.pop()
ans_list = []
for i in range(1, n - 1):
    ans_list.append([[a_right, a_left][a[i] >= 0], a[i]])
    a_right, a_left = a_right - [a[i], 0][a[i] >= 0], a_left - [0, a[i]][a[i] >= 0]
ans_list.append([a_right, a_left])
print(a_right - a_left)
[print(*ans_list[i]) for i in range(n-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 a = [int(i) for i in input().split()] a [int(i) for i in input().split()] a.sort() a.sort a sort a_left, a_right = a[0], a.pop() a_left a[0] a 0 a_right a.pop() a.pop a pop ans_list = [] ans_list [] for i in range(1, n - 1):
    ans_list.append([[a_right, a_left][a[i] >= 0], a[i]])
    a_right, a_left = a_right - [a[i], 0][a[i] >= 0], a_left - [0, a[i]][a[i] >= 0] i range(1, n - 1) range 1 n - 1 n 1 ans_list.append([[a_right, a_left][a[i] >= 0], a[i]]) ans_list.append ans_list append [[a_right, a_left][a[i] >= 0], a[i]] [a_right, a_left][a[i] >= 0] [a_right, a_left] a_right a_left a[i] >= 0 a[i] a i 0 a[i] a i a_right, a_left = a_right - [a[i], 0][a[i] >= 0], a_left - [0, a[i]][a[i] >= 0] a_right a_right - [a[i], 0][a[i] >= 0] a_right [a[i], 0][a[i] >= 0] [a[i], 0] a[i] a i 0 a[i] >= 0 a[i] a i 0 a_left a_left - [0, a[i]][a[i] >= 0] a_left [0, a[i]][a[i] >= 0] [0, a[i]] 0 a[i] a i a[i] >= 0 a[i] a i 0 ans_list.append([a_right, a_left]) ans_list.append ans_list append [a_right, a_left] a_right a_left print(a_right - a_left) print a_right - a_left a_right a_left print(*ans_list[i]) for i in range(n-1) for i in range(n-1) i range(n-1) range n-1 n 1 for i in range(n-1) print(*ans_list[i]) print *ans_list[i] ans_list[i] ans_list i [print(*ans_list[i]) for i in range(n-1)] a_left, a_right = a[0], a.pop() a[0] a_left n = int(input()) int(input()) n a_right, a_left = a_right - [a[i], 0][a[i] >= 0], a_left - [0, a[i]][a[i] >= 0] a_right - [a[i], 0][a[i] >= 0] a_right a = [int(i) for i in input().split()] [int(i) for i in input().split()] a a_left = a_right - [a[i], 0][a[i] >= 0], a_left - [0, a[i]][a[i] >= 0] a_left - [0, a[i]][a[i] >= 0] a_left ans_list = [] [] ans_list a_right = a[0], a.pop() a.pop() a_right
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
a_left, a_right = a[0], a.pop()
ans_list = []
for i in range(1, n - 1):
    ans_list.append([[a_right, a_left][a[i] >= 0], a[i]])
    a_right, a_left = a_right - [a[i], 0][a[i] >= 0], a_left - [0, a[i]][a[i] >= 0]
ans_list.append([a_right, a_left])
print(a_right - a_left)
[print(*ans_list[i]) for i in range(n-1)]