N = int(input())

A_list = list(map(int, input().split()))

A_sorted = sorted(A_list)

pos_count = len([a for a in A_sorted if a >= 0])
neg_count = len([a for a in A_sorted if a < 0])

if pos_count == 0:
    pos_count = 1
    neg_count = N - 1
if neg_count == 0:
    pos_count = N - 1
    neg_count = 1

output_list = [0] * (N - 1)
count = 0
for q in range(neg_count, N - 1):
    output_list[count] = [A_sorted[0], A_sorted[q]]
    count += 1
    A_sorted[0] -= A_sorted[q]


for i in range(neg_count):
    output_list[count] = [A_sorted[N - 1], A_sorted[i]]
    count += 1
    A_sorted[N - 1] -= A_sorted[i]

print(A_sorted[N - 1])
for item in output_list:
    print(item[0], item[1]) N = int(input()) N int(input()) int input() input A_list = list(map(int, input().split())) A_list list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A_sorted = sorted(A_list) A_sorted sorted(A_list) sorted A_list a for a in A_sorted if a >= 0 for a in A_sorted if a >= 0 a A_sorted a >= 0 a 0 if a >= 0 a pos_count = len([a for a in A_sorted if a >= 0]) pos_count len([a for a in A_sorted if a >= 0]) len [a for a in A_sorted if a >= 0] a for a in A_sorted if a < 0 for a in A_sorted if a < 0 a A_sorted a < 0 a 0 if a < 0 a neg_count = len([a for a in A_sorted if a < 0]) neg_count len([a for a in A_sorted if a < 0]) len [a for a in A_sorted if a < 0] if pos_count == 0:
    pos_count = 1
    neg_count = N - 1 pos_count == 0 pos_count 0 pos_count = 1 pos_count 1 neg_count = N - 1 neg_count N - 1 N 1 if neg_count == 0:
    pos_count = N - 1
    neg_count = 1 neg_count == 0 neg_count 0 pos_count = N - 1 pos_count N - 1 N 1 neg_count = 1 neg_count 1 output_list = [0] * (N - 1) output_list [0] * (N - 1) [0] 0 N - 1 N 1 count = 0 count 0 for q in range(neg_count, N - 1):
    output_list[count] = [A_sorted[0], A_sorted[q]]
    count += 1
    A_sorted[0] -= A_sorted[q] q range(neg_count, N - 1) range neg_count N - 1 N 1 output_list[count] = [A_sorted[0], A_sorted[q]] output_list[count] output_list count [A_sorted[0], A_sorted[q]] A_sorted[0] A_sorted 0 A_sorted[q] A_sorted q count += 1 count 1 A_sorted[0] -= A_sorted[q] A_sorted[0] A_sorted 0 A_sorted[q] A_sorted q for i in range(neg_count):
    output_list[count] = [A_sorted[N - 1], A_sorted[i]]
    count += 1
    A_sorted[N - 1] -= A_sorted[i] i range(neg_count) range neg_count output_list[count] = [A_sorted[N - 1], A_sorted[i]] output_list[count] output_list count [A_sorted[N - 1], A_sorted[i]] A_sorted[N - 1] A_sorted N - 1 N 1 A_sorted[i] A_sorted i count += 1 count 1 A_sorted[N - 1] -= A_sorted[i] A_sorted[N - 1] A_sorted N - 1 N 1 A_sorted[i] A_sorted i print(A_sorted[N - 1]) print A_sorted[N - 1] A_sorted N - 1 N 1 for item in output_list:
    print(item[0], item[1]) item output_list print(item[0], item[1]) print item[0] item 0 item[1] item 1 count = 0 0 count neg_count = N - 1 N - 1 neg_count neg_count = len([a for a in A_sorted if a < 0]) len([a for a in A_sorted if a < 0]) neg_count A_sorted = sorted(A_list) sorted(A_list) A_sorted N = int(input()) int(input()) N output_list = [0] * (N - 1) [0] * (N - 1) output_list count += 1 1 count pos_count = len([a for a in A_sorted if a >= 0]) len([a for a in A_sorted if a >= 0]) pos_count pos_count = N - 1 N - 1 pos_count pos_count = 1 1 pos_count A_list = list(map(int, input().split())) list(map(int, input().split())) A_list count += 1 1 count neg_count = 1 1 neg_count
N = int(input())

A_list = list(map(int, input().split()))

A_sorted = sorted(A_list)

pos_count = len([a for a in A_sorted if a >= 0])
neg_count = len([a for a in A_sorted if a < 0])

if pos_count == 0:
    pos_count = 1
    neg_count = N - 1
if neg_count == 0:
    pos_count = N - 1
    neg_count = 1

output_list = [0] * (N - 1)
count = 0
for q in range(neg_count, N - 1):
    output_list[count] = [A_sorted[0], A_sorted[q]]
    count += 1
    A_sorted[0] -= A_sorted[q]


for i in range(neg_count):
    output_list[count] = [A_sorted[N - 1], A_sorted[i]]
    count += 1
    A_sorted[N - 1] -= A_sorted[i]

print(A_sorted[N - 1])
for item in output_list:
    print(item[0], item[1])