n = int(input())
a = [int(i) for i in input().split()]
ans = 0
a.sort()
a_left, a_right = a[0], a.pop()
minus, plus = [], []
for i in range(1, n - 1):
    if a[i] < 0:
        minus.append(a[i])
    else:
        plus.append(a[i])

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

ans_list = []
for i in range(len(minus)):
    ans_list.append([a_right ,minus[i]])
    a_right -= minus[i]
for i in range(len(plus)):
    ans_list.append([a_left ,plus[i]])
    a_left -= plus[i]
ans_list.append([a_right, a_left])

print(a_right - a_left)
[print(*ans_list[i]) for i in range(n-1)]