N = int(input())
A = list(map(int,input().split()))
A.sort()
final_list = []
plus = sum(x >= 0 for x in A)

def pop(length, flag):
  val = A[flag]
  A.pop(flag)
  for i in range(length):
    next_add = A[-1 - flag]
    final_list.append((val, next_add))
    val = val - next_add
    A.pop(-1 - flag)
  return val

if plus == N: #全部正の数
  ans = pop(N - 2, 0)
  final_list.append((max(ans, A[0]), min(ans, A[0])))
  ans = abs(ans - A[0])
elif plus == 0: #全部負の数
  ans = pop(N - 2, -1)
  final_list.append((max(ans, A[0]), min(ans, A[0])))
  ans = abs(ans - A[0])
else:
  ans_neg = pop(plus - 1, 0)
  ans_pos = pop(N - plus - 1, -1)
  final_list.append((ans_pos, ans_neg))
  ans = ans_pos - ans_neg
  


print(ans)
for i in range(len(final_list)):
  print(final_list[i][0], " ", final_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.sort() A.sort A sort final_list = [] final_list [] plus = sum(x >= 0 for x in A) plus sum(x >= 0 for x in A) sum x >= 0 x 0 def pop(length, flag):
  val = A[flag]
  A.pop(flag)
  for i in range(length):
    next_add = A[-1 - flag]
    final_list.append((val, next_add))
    val = val - next_add
    A.pop(-1 - flag)
  return val pop val = A[flag] val A[flag] A flag A.pop(flag) A.pop A pop flag for i in range(length):
    next_add = A[-1 - flag]
    final_list.append((val, next_add))
    val = val - next_add
    A.pop(-1 - flag)
   i range(length) range length next_add = A[-1 - flag] next_add A[-1 - flag] A -1 - flag -1 flag final_list.append((val, next_add)) final_list.append final_list append (val, next_add) val next_add val = val - next_add val val - next_add val next_add A.pop(-1 - flag) A.pop A pop -1 - flag -1 flag return val val length length flag flag if plus == N: #全部正の数
  ans = pop(N - 2, 0)
  final_list.append((max(ans, A[0]), min(ans, A[0])))
  ans = abs(ans - A[0])
elif plus == 0: #全部負の数
  ans = pop(N - 2, -1)
  final_list.append((max(ans, A[0]), min(ans, A[0])))
  ans = abs(ans - A[0])
else:
  ans_neg = pop(plus - 1, 0)
  ans_pos = pop(N - plus - 1, -1)
  final_list.append((ans_pos, ans_neg))
  ans = ans_pos - ans_neg
   plus == N plus N ans = pop(N - 2, 0) ans pop(N - 2, 0) pop N - 2 N 2 0 final_list.append((max(ans, A[0]), min(ans, A[0]))) final_list.append final_list append (max(ans, A[0]), min(ans, A[0])) max(ans, A[0]) max ans A[0] A 0 min(ans, A[0]) min ans A[0] A 0 ans = abs(ans - A[0]) ans abs(ans - A[0]) abs ans - A[0] ans A[0] A 0 elif plus == 0: #全部負の数
  ans = pop(N - 2, -1)
  final_list.append((max(ans, A[0]), min(ans, A[0])))
  ans = abs(ans - A[0]) plus == 0 plus 0 ans = pop(N - 2, -1) ans pop(N - 2, -1) pop N - 2 N 2 -1 final_list.append((max(ans, A[0]), min(ans, A[0]))) final_list.append final_list append (max(ans, A[0]), min(ans, A[0])) max(ans, A[0]) max ans A[0] A 0 min(ans, A[0]) min ans A[0] A 0 ans = abs(ans - A[0]) ans abs(ans - A[0]) abs ans - A[0] ans A[0] A 0 ans_neg = pop(plus - 1, 0) ans_neg pop(plus - 1, 0) pop plus - 1 plus 1 0 ans_pos = pop(N - plus - 1, -1) ans_pos pop(N - plus - 1, -1) pop N - plus - 1 N - plus N plus 1 -1 final_list.append((ans_pos, ans_neg)) final_list.append final_list append (ans_pos, ans_neg) ans_pos ans_neg ans = ans_pos - ans_neg ans ans_pos - ans_neg ans_pos ans_neg print(ans) print ans for i in range(len(final_list)):
  print(final_list[i][0], " ", final_list[i][1]) i range(len(final_list)) range len(final_list) len final_list print(final_list[i][0], " ", final_list[i][1]) print final_list[i][0] [i] final_list i 0 " " final_list[i][1] [i] final_list i 1 ans_pos = pop(N - plus - 1, -1) pop(N - plus - 1, -1) ans_pos plus = sum(x >= 0 for x in A) sum(x >= 0 for x in A) plus ans = abs(ans - A[0]) abs(ans - A[0]) ans final_list = [] [] final_list ans_neg = pop(plus - 1, 0) pop(plus - 1, 0) ans_neg ans = pop(N - 2, 0) pop(N - 2, 0) ans ans = abs(ans - A[0]) abs(ans - A[0]) ans ans = ans_pos - ans_neg ans_pos - ans_neg ans N = int(input()) int(input()) N A = list(map(int,input().split())) list(map(int,input().split())) A def pop(length, flag):
  val = A[flag]
  A.pop(flag)
  for i in range(length):
    next_add = A[-1 - flag]
    final_list.append((val, next_add))
    val = val - next_add
    A.pop(-1 - flag)
  return val def pop(length, flag):
  val = A[flag]
  A.pop(flag)
  for i in range(length):
    next_add = A[-1 - flag]
    final_list.append((val, next_add))
    val = val - next_add
    A.pop(-1 - flag)
  return val pop ans = pop(N - 2, -1) pop(N - 2, -1) ans
N = int(input())
A = list(map(int,input().split()))
A.sort()
final_list = []
plus = sum(x >= 0 for x in A)

def pop(length, flag):
  val = A[flag]
  A.pop(flag)
  for i in range(length):
    next_add = A[-1 - flag]
    final_list.append((val, next_add))
    val = val - next_add
    A.pop(-1 - flag)
  return val

if plus == N: #全部正の数
  ans = pop(N - 2, 0)
  final_list.append((max(ans, A[0]), min(ans, A[0])))
  ans = abs(ans - A[0])
elif plus == 0: #全部負の数
  ans = pop(N - 2, -1)
  final_list.append((max(ans, A[0]), min(ans, A[0])))
  ans = abs(ans - A[0])
else:
  ans_neg = pop(plus - 1, 0)
  ans_pos = pop(N - plus - 1, -1)
  final_list.append((ans_pos, ans_neg))
  ans = ans_pos - ans_neg
  


print(ans)
for i in range(len(final_list)):
  print(final_list[i][0], " ", final_list[i][1])