output_description: Print the maximum possible value M of the final integer on the blackboard, and
  a sequence of operations x_i, y_i that maximizes the final integer, in the
  format below.
  
  Here x_i and y_i represent the integers x and y chosen in the i-th operation,
  respectively.
  
  If there are multiple sequences of operations that maximize the final integer,
  any of them will be accepted.
  
      
      
      M
      x_1 y_1
      :
      x_{N-1} y_{N-1}
      
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N
      A_1 A_2 ... A_N
attempt: import numpy as np
  
  
  N = int(input())
  
  poss, negs = [], []
  npos, nneg = 0, 0
  for a in input().split():
      ia = int(a)
      if ia < 0:
          negs.append(ia)
          nneg += 1
      else:
          poss.append(ia)
          npos += 1
  
  # import random
  # N = 100000
  # npos, nneg = 40000, 60000
  # poss = [random.randint(1, 1000) for _ in range(npos)]
  # negs = [random.randint(-1000, -1) for _ in range(nneg)]
  #
  # poss = []
  # negs = [-1, -1, -1]
  # npos, nneg = len(poss), len(negs)
  # N = npos + nneg
  
  if N == 2:
      a1, a2 = poss + negs
      if a1 < a2:
          print(a2 - a1)
          print(a2, a1)
      else:
          print(a1 - a2)
          print(a1, a2)
      exit(0)
  
  if nneg == 0:
      print(sum(poss) - min(poss) * 2)
      argmin = np.array(poss).argmin()
      minpos = poss.pop(argmin)
      pos = poss.pop()
      print(minpos, pos)
      negs.append(minpos - pos)
      npos -= 2
      nneg += 1
  elif npos == 0:
      print(-sum(negs) + max(negs) * 2)
      argmax = np.array(negs).argmax()
      maxneg = negs.pop(argmax)  # -1とか
      neg = negs.pop()  # -5とか
      print(maxneg, neg)
      poss.append(maxneg - neg)
      nneg -= 2
      npos += 1
  else:
      print(sum(poss) - sum(negs))
  
  if npos > nneg:
      for _ in range(npos - nneg):
          pos, neg = poss.pop(), negs.pop()
          print(neg, pos)
          negs.append(neg - pos)
  elif npos < nneg:
      for _ in range(nneg - npos):
          pos, neg = poss.pop(), negs.pop()
          print(pos, neg)
          poss.append(pos - neg)
  
  for i in range(min(nneg, npos) - 1):
      pos, neg = poss.pop(), negs.pop()
      print(neg, pos)
      negs.append(neg - pos)
      pos, neg = poss.pop(), negs.pop()
      print(pos, neg)
      poss.append(pos - neg)
  
  pos, neg = poss.pop(), negs.pop()
  print(pos, neg)
  
problem_description: Statement
  
  There are N integers, A_1, A_2, ..., A_N, written on a blackboard.
  
  We will repeat the following operation N-1 times so that we have only one
  integer on the blackboard.
  
    * Choose two integers x and y on the blackboard and erase these two integers. Then, write a new integer x-y.
  
  Find the maximum possible value of the final integer on the blackboard and a
  sequence of operations that maximizes the final integer.
samples: [{"input": "3\n    1 -1 2", "output": "4\n    -1 1\n    2 -2\n    \n\nIf we choose x = -1 and y = 1 in the first operation, the set of integers\nwritten on the blackboard becomes (-2, 2).\n\nThen, if we choose x = 2 and y = -2 in the second operation, the set of\nintegers written on the blackboard becomes (4).\n\nIn this case, we have 4 as the final integer. We cannot end with a greater\ninteger, so the answer is 4.\n\n* * *"}, {"input": "3\n    1 1 1", "output": "1\n    1 1\n    1 0"}]