N = int(input())
A = list(map(int, input().split()))

A_plus = []
A_minus = []
for i in range(N):
    if A[i] >= 0:
        A_plus.append(A[i])
    else:
        A_minus.append(A[i])

if len(A_plus) == 0:
    A_plus.append(A_minus.pop(A_minus.index(max(A_minus))))
elif len(A_minus) == 0:
    A_minus.append(A_plus.pop(A_plus.index(min(A_plus))))
        
ans_list = []
while len(A_plus) + len(A_minus) != 1:
    if len(A_plus) <= len(A_minus):
        x = A_plus.pop(0)
        y = A_minus.pop(0)
        ans_list.append([x, y])
        A_plus.append(x-y)
    else:
        x = A_minus.pop(0)
        y = A_plus.pop(0)
        ans_list.append([x, y])
        A_minus.append(x-y)

M = A_plus[0]
print(M)
for i in range(len(ans_list)):
    print(ans_list[i][0], ans_list[i][1]) N = int(input()) N int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A_plus = [] A_plus [] A_minus = [] A_minus [] for i in range(N):
    if A[i] >= 0:
        A_plus.append(A[i])
    else:
        A_minus.append(A[i]) i range(N) range N if A[i] >= 0:
        A_plus.append(A[i])
    else:
        A_minus.append(A[i]) A[i] >= 0 A[i] A i 0 A_plus.append(A[i]) A_plus.append A_plus append A[i] A i A_minus.append(A[i]) A_minus.append A_minus append A[i] A i if len(A_plus) == 0:
    A_plus.append(A_minus.pop(A_minus.index(max(A_minus))))
elif len(A_minus) == 0:
    A_minus.append(A_plus.pop(A_plus.index(min(A_plus))))
         len(A_plus) == 0 len(A_plus) len A_plus 0 A_plus.append(A_minus.pop(A_minus.index(max(A_minus)))) A_plus.append A_plus append A_minus.pop(A_minus.index(max(A_minus))) A_minus.pop A_minus pop A_minus.index(max(A_minus)) A_minus.index A_minus index max(A_minus) max A_minus elif len(A_minus) == 0:
    A_minus.append(A_plus.pop(A_plus.index(min(A_plus))))
         len(A_minus) == 0 len(A_minus) len A_minus 0 A_minus.append(A_plus.pop(A_plus.index(min(A_plus)))) A_minus.append A_minus append A_plus.pop(A_plus.index(min(A_plus))) A_plus.pop A_plus pop A_plus.index(min(A_plus)) A_plus.index A_plus index min(A_plus) min A_plus ans_list = [] ans_list [] while len(A_plus) + len(A_minus) != 1:
    if len(A_plus) <= len(A_minus):
        x = A_plus.pop(0)
        y = A_minus.pop(0)
        ans_list.append([x, y])
        A_plus.append(x-y)
    else:
        x = A_minus.pop(0)
        y = A_plus.pop(0)
        ans_list.append([x, y])
        A_minus.append(x-y) len(A_plus) + len(A_minus) != 1 len(A_plus) + len(A_minus) len(A_plus) len A_plus len(A_minus) len A_minus 1 if len(A_plus) <= len(A_minus):
        x = A_plus.pop(0)
        y = A_minus.pop(0)
        ans_list.append([x, y])
        A_plus.append(x-y)
    else:
        x = A_minus.pop(0)
        y = A_plus.pop(0)
        ans_list.append([x, y])
        A_minus.append(x-y) len(A_plus) <= len(A_minus) len(A_plus) len A_plus len(A_minus) len A_minus x = A_plus.pop(0) x A_plus.pop(0) A_plus.pop A_plus pop 0 y = A_minus.pop(0) y A_minus.pop(0) A_minus.pop A_minus pop 0 ans_list.append([x, y]) ans_list.append ans_list append [x, y] x y A_plus.append(x-y) A_plus.append A_plus append x-y x y x = A_minus.pop(0) x A_minus.pop(0) A_minus.pop A_minus pop 0 y = A_plus.pop(0) y A_plus.pop(0) A_plus.pop A_plus pop 0 ans_list.append([x, y]) ans_list.append ans_list append [x, y] x y A_minus.append(x-y) A_minus.append A_minus append x-y x y M = A_plus[0] M A_plus[0] A_plus 0 print(M) print M for i in range(len(ans_list)):
    print(ans_list[i][0], ans_list[i][1]) i range(len(ans_list)) range len(ans_list) len ans_list print(ans_list[i][0], ans_list[i][1]) print ans_list[i][0] [i] ans_list i 0 ans_list[i][1] [i] ans_list i 1 x = A_minus.pop(0) A_minus.pop(0) x y = A_minus.pop(0) A_minus.pop(0) y y = A_plus.pop(0) A_plus.pop(0) y A_plus = [] [] A_plus A = list(map(int, input().split())) list(map(int, input().split())) A A_minus = [] [] A_minus ans_list = [] [] ans_list M = A_plus[0] A_plus[0] M N = int(input()) int(input()) N x = A_plus.pop(0) A_plus.pop(0) x
N = int(input())
A = list(map(int, input().split()))

A_plus = []
A_minus = []
for i in range(N):
    if A[i] >= 0:
        A_plus.append(A[i])
    else:
        A_minus.append(A[i])

if len(A_plus) == 0:
    A_plus.append(A_minus.pop(A_minus.index(max(A_minus))))
elif len(A_minus) == 0:
    A_minus.append(A_plus.pop(A_plus.index(min(A_plus))))
        
ans_list = []
while len(A_plus) + len(A_minus) != 1:
    if len(A_plus) <= len(A_minus):
        x = A_plus.pop(0)
        y = A_minus.pop(0)
        ans_list.append([x, y])
        A_plus.append(x-y)
    else:
        x = A_minus.pop(0)
        y = A_plus.pop(0)
        ans_list.append([x, y])
        A_minus.append(x-y)

M = A_plus[0]
print(M)
for i in range(len(ans_list)):
    print(ans_list[i][0], ans_list[i][1])