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

answer = []
if len(set(A)) == 1: #全て同じ
  if A[0] >= 0:
    for i in range(2, N):
      answer.append((A[1], A[i]))
      A[1] -= A[i]
    answer.append((A[0], A[1]))
    answer_A = A[0] - A[1]
  else:
    for i in range(1, N):
      answer.append((A[0], A[i]))
      A[0] -= A[i]
    answer_A = A[0]
else:
  max_A = max(A)
  min_A = min(A)
  for i in range(N):
    if A[i] == max_A:
      max_i = i
    if A[i] == min_A:
      min_i = i
  for i in range(N):
    if i != max_i and i != min_i:
      if A[i] >= 0:
        answer.append((A[min_i], A[i]))
        A[min_i] -= A[i]
      else:
        answer.append((A[max_i], A[i]))
        A[max_i] -= A[i]
  answer.append((A[max_i], A[min_i]))
  answer_A = A[max_i] - A[min_i]

print(answer_A)
for a in answer:
  print(*a) 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 answer = [] answer [] if len(set(A)) == 1: #全て同じ
  if A[0] >= 0:
    for i in range(2, N):
      answer.append((A[1], A[i]))
      A[1] -= A[i]
    answer.append((A[0], A[1]))
    answer_A = A[0] - A[1]
  else:
    for i in range(1, N):
      answer.append((A[0], A[i]))
      A[0] -= A[i]
    answer_A = A[0]
else:
  max_A = max(A)
  min_A = min(A)
  for i in range(N):
    if A[i] == max_A:
      max_i = i
    if A[i] == min_A:
      min_i = i
  for i in range(N):
    if i != max_i and i != min_i:
      if A[i] >= 0:
        answer.append((A[min_i], A[i]))
        A[min_i] -= A[i]
      else:
        answer.append((A[max_i], A[i]))
        A[max_i] -= A[i]
  answer.append((A[max_i], A[min_i]))
  answer_A = A[max_i] - A[min_i] len(set(A)) == 1 len(set(A)) len set(A) set A 1 if A[0] >= 0:
    for i in range(2, N):
      answer.append((A[1], A[i]))
      A[1] -= A[i]
    answer.append((A[0], A[1]))
    answer_A = A[0] - A[1]
  else:
    for i in range(1, N):
      answer.append((A[0], A[i]))
      A[0] -= A[i]
    answer_A = A[0] A[0] >= 0 A[0] A 0 0 for i in range(2, N):
      answer.append((A[1], A[i]))
      A[1] -= A[i]
     i range(2, N) range 2 N answer.append((A[1], A[i])) answer.append answer append (A[1], A[i]) A[1] A 1 A[i] A i A[1] -= A[i] A[1] A 1 A[i] A i answer.append((A[0], A[1])) answer.append answer append (A[0], A[1]) A[0] A 0 A[1] A 1 answer_A = A[0] - A[1] answer_A A[0] - A[1] A[0] A 0 A[1] A 1 for i in range(1, N):
      answer.append((A[0], A[i]))
      A[0] -= A[i]
     i range(1, N) range 1 N answer.append((A[0], A[i])) answer.append answer append (A[0], A[i]) A[0] A 0 A[i] A i A[0] -= A[i] A[0] A 0 A[i] A i answer_A = A[0] answer_A A[0] A 0 max_A = max(A) max_A max(A) max A min_A = min(A) min_A min(A) min A for i in range(N):
    if A[i] == max_A:
      max_i = i
    if A[i] == min_A:
      min_i = i
   i range(N) range N if A[i] == max_A:
      max_i = i
     A[i] == max_A A[i] A i max_A max_i = i max_i i if A[i] == min_A:
      min_i = i
   A[i] == min_A A[i] A i min_A min_i = i min_i i for i in range(N):
    if i != max_i and i != min_i:
      if A[i] >= 0:
        answer.append((A[min_i], A[i]))
        A[min_i] -= A[i]
      else:
        answer.append((A[max_i], A[i]))
        A[max_i] -= A[i]
   i range(N) range N if i != max_i and i != min_i:
      if A[i] >= 0:
        answer.append((A[min_i], A[i]))
        A[min_i] -= A[i]
      else:
        answer.append((A[max_i], A[i]))
        A[max_i] -= A[i]
   i != max_i and i != min_i i != max_i i max_i i != min_i i min_i if A[i] >= 0:
        answer.append((A[min_i], A[i]))
        A[min_i] -= A[i]
      else:
        answer.append((A[max_i], A[i]))
        A[max_i] -= A[i]
   A[i] >= 0 A[i] A i 0 answer.append((A[min_i], A[i])) answer.append answer append (A[min_i], A[i]) A[min_i] A min_i A[i] A i A[min_i] -= A[i] A[min_i] A min_i A[i] A i answer.append((A[max_i], A[i])) answer.append answer append (A[max_i], A[i]) A[max_i] A max_i A[i] A i A[max_i] -= A[i] A[max_i] A max_i A[i] A i answer.append((A[max_i], A[min_i])) answer.append answer append (A[max_i], A[min_i]) A[max_i] A max_i A[min_i] A min_i answer_A = A[max_i] - A[min_i] answer_A A[max_i] - A[min_i] A[max_i] A max_i A[min_i] A min_i print(answer_A) print answer_A for a in answer:
  print(*a) a answer print(*a) print *a a min_i = i i min_i max_i = i i max_i answer_A = A[0] - A[1] A[0] - A[1] answer_A answer_A = A[0] A[0] answer_A A = list(map(int, input().split())) list(map(int, input().split())) A min_A = min(A) min(A) min_A answer = [] [] answer max_A = max(A) max(A) max_A N = int(input()) int(input()) N answer_A = A[max_i] - A[min_i] A[max_i] - A[min_i] answer_A
N = int(input())
A = list(map(int, input().split()))

answer = []
if len(set(A)) == 1: #全て同じ
  if A[0] >= 0:
    for i in range(2, N):
      answer.append((A[1], A[i]))
      A[1] -= A[i]
    answer.append((A[0], A[1]))
    answer_A = A[0] - A[1]
  else:
    for i in range(1, N):
      answer.append((A[0], A[i]))
      A[0] -= A[i]
    answer_A = A[0]
else:
  max_A = max(A)
  min_A = min(A)
  for i in range(N):
    if A[i] == max_A:
      max_i = i
    if A[i] == min_A:
      min_i = i
  for i in range(N):
    if i != max_i and i != min_i:
      if A[i] >= 0:
        answer.append((A[min_i], A[i]))
        A[min_i] -= A[i]
      else:
        answer.append((A[max_i], A[i]))
        A[max_i] -= A[i]
  answer.append((A[max_i], A[min_i]))
  answer_A = A[max_i] - A[min_i]

print(answer_A)
for a in answer:
  print(*a)