n = int(input())
L = list(map(int,input().split()))
L.sort()
T = []
plus = []
minus = []
for i in range(n):
  if L[i] >= 0:
    plus.append(L[i])
  else:
    minus.append(L[i])
if len(L) == 2:
  if len(plus) == len(minus):
    print(plus[0]-minus[0])
    print(plus[0],minus[0])
  elif len(plus) == 2:
    print(plus[1]-plus[0])
    print(plus[1],plus[0])
  else:
    print(minus[1]-minus[0])
    print(minus[1],minus[0])
else:
  if len(plus) != 0 and len(minus) != 0:
    if min(len(plus),len(minus)) >= 2:
      T.append([minus[0],plus[0]])
      cur = minus[0]-plus[0]
      for i in range(1,len(plus)-1):
        T.append([cur,plus[i]])
        cur = cur-plus[i]
      T.append([plus[len(plus)-1],cur])
      cur = plus[len(plus)-1]-cur
      for i in range(1,len(minus)):
        T.append([cur,minus[i]])
        cur = cur-minus[i]
      print(cur)
      for i in range(len(T)):
        print(T[i][0],T[i][1])
    else:
      if len(minus) == 1:
        cur = minus[0]
        T.append([cur,plus[0]])
        cur = cur-plus[0]
        for i in range(1,len(plus)-1):
          T.append([cur,plus[i]])
          cur = cur-plus[i]
        T.append([plus[len(plus)-1],cur])
        cur = plus[len(plus)-1]-cur
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
      else:
        cur = plus[0]
        T.append([cur,minus[0]])
        cur = cur-minus[0]
        for i in range(1,len(minus)):
          T.append([cur,minus[i]])
          cur = cur-minus[i]
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
  elif len(plus) == 0:
    cur = minus[len(minus)-1]
    for i in range(n-1):
      T.append([cur,minus[n-i-2]])
      cur = cur-minus[n-i-2]
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1])
  else:
    cur = plus[0]
    for i in range(1,n-1):
      T.append([cur,plus[i]])
      cur = cur-plus[i]
    T.append([plus[n-1],cur])
    cur = plus[n-1]-cur
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1]) n = int(input()) n int(input()) int input() input L = list(map(int,input().split())) L list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split L.sort() L.sort L sort T = [] T [] plus = [] plus [] minus = [] minus [] for i in range(n):
  if L[i] >= 0:
    plus.append(L[i])
  else:
    minus.append(L[i]) i range(n) range n if L[i] >= 0:
    plus.append(L[i])
  else:
    minus.append(L[i]) L[i] >= 0 L[i] L i 0 plus.append(L[i]) plus.append plus append L[i] L i minus.append(L[i]) minus.append minus append L[i] L i if len(L) == 2:
  if len(plus) == len(minus):
    print(plus[0]-minus[0])
    print(plus[0],minus[0])
  elif len(plus) == 2:
    print(plus[1]-plus[0])
    print(plus[1],plus[0])
  else:
    print(minus[1]-minus[0])
    print(minus[1],minus[0])
else:
  if len(plus) != 0 and len(minus) != 0:
    if min(len(plus),len(minus)) >= 2:
      T.append([minus[0],plus[0]])
      cur = minus[0]-plus[0]
      for i in range(1,len(plus)-1):
        T.append([cur,plus[i]])
        cur = cur-plus[i]
      T.append([plus[len(plus)-1],cur])
      cur = plus[len(plus)-1]-cur
      for i in range(1,len(minus)):
        T.append([cur,minus[i]])
        cur = cur-minus[i]
      print(cur)
      for i in range(len(T)):
        print(T[i][0],T[i][1])
    else:
      if len(minus) == 1:
        cur = minus[0]
        T.append([cur,plus[0]])
        cur = cur-plus[0]
        for i in range(1,len(plus)-1):
          T.append([cur,plus[i]])
          cur = cur-plus[i]
        T.append([plus[len(plus)-1],cur])
        cur = plus[len(plus)-1]-cur
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
      else:
        cur = plus[0]
        T.append([cur,minus[0]])
        cur = cur-minus[0]
        for i in range(1,len(minus)):
          T.append([cur,minus[i]])
          cur = cur-minus[i]
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
  elif len(plus) == 0:
    cur = minus[len(minus)-1]
    for i in range(n-1):
      T.append([cur,minus[n-i-2]])
      cur = cur-minus[n-i-2]
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1])
  else:
    cur = plus[0]
    for i in range(1,n-1):
      T.append([cur,plus[i]])
      cur = cur-plus[i]
    T.append([plus[n-1],cur])
    cur = plus[n-1]-cur
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1]) len(L) == 2 len(L) len L 2 if len(plus) == len(minus):
    print(plus[0]-minus[0])
    print(plus[0],minus[0])
  elif len(plus) == 2:
    print(plus[1]-plus[0])
    print(plus[1],plus[0])
  else:
    print(minus[1]-minus[0])
    print(minus[1],minus[0]) len(plus) == len(minus) len(plus) len plus len(minus) len minus print(plus[0]-minus[0]) print plus[0]-minus[0] plus[0] plus 0 minus[0] minus 0 print(plus[0],minus[0]) print plus[0] plus 0 minus[0] minus 0 elif len(plus) == 2:
    print(plus[1]-plus[0])
    print(plus[1],plus[0])
   len(plus) == 2 len(plus) len plus 2 print(plus[1]-plus[0]) print plus[1]-plus[0] plus[1] plus 1 plus[0] plus 0 print(plus[1],plus[0]) print plus[1] plus 1 plus[0] plus 0 print(minus[1]-minus[0]) print minus[1]-minus[0] minus[1] minus 1 minus[0] minus 0 print(minus[1],minus[0]) print minus[1] minus 1 minus[0] minus 0 if len(plus) != 0 and len(minus) != 0:
    if min(len(plus),len(minus)) >= 2:
      T.append([minus[0],plus[0]])
      cur = minus[0]-plus[0]
      for i in range(1,len(plus)-1):
        T.append([cur,plus[i]])
        cur = cur-plus[i]
      T.append([plus[len(plus)-1],cur])
      cur = plus[len(plus)-1]-cur
      for i in range(1,len(minus)):
        T.append([cur,minus[i]])
        cur = cur-minus[i]
      print(cur)
      for i in range(len(T)):
        print(T[i][0],T[i][1])
    else:
      if len(minus) == 1:
        cur = minus[0]
        T.append([cur,plus[0]])
        cur = cur-plus[0]
        for i in range(1,len(plus)-1):
          T.append([cur,plus[i]])
          cur = cur-plus[i]
        T.append([plus[len(plus)-1],cur])
        cur = plus[len(plus)-1]-cur
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
      else:
        cur = plus[0]
        T.append([cur,minus[0]])
        cur = cur-minus[0]
        for i in range(1,len(minus)):
          T.append([cur,minus[i]])
          cur = cur-minus[i]
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
  elif len(plus) == 0:
    cur = minus[len(minus)-1]
    for i in range(n-1):
      T.append([cur,minus[n-i-2]])
      cur = cur-minus[n-i-2]
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1])
  else:
    cur = plus[0]
    for i in range(1,n-1):
      T.append([cur,plus[i]])
      cur = cur-plus[i]
    T.append([plus[n-1],cur])
    cur = plus[n-1]-cur
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1]) len(plus) != 0 and len(minus) != 0 len(plus) != 0 len(plus) len plus 0 len(minus) != 0 len(minus) len minus 0 if min(len(plus),len(minus)) >= 2:
      T.append([minus[0],plus[0]])
      cur = minus[0]-plus[0]
      for i in range(1,len(plus)-1):
        T.append([cur,plus[i]])
        cur = cur-plus[i]
      T.append([plus[len(plus)-1],cur])
      cur = plus[len(plus)-1]-cur
      for i in range(1,len(minus)):
        T.append([cur,minus[i]])
        cur = cur-minus[i]
      print(cur)
      for i in range(len(T)):
        print(T[i][0],T[i][1])
    else:
      if len(minus) == 1:
        cur = minus[0]
        T.append([cur,plus[0]])
        cur = cur-plus[0]
        for i in range(1,len(plus)-1):
          T.append([cur,plus[i]])
          cur = cur-plus[i]
        T.append([plus[len(plus)-1],cur])
        cur = plus[len(plus)-1]-cur
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
      else:
        cur = plus[0]
        T.append([cur,minus[0]])
        cur = cur-minus[0]
        for i in range(1,len(minus)):
          T.append([cur,minus[i]])
          cur = cur-minus[i]
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
   min(len(plus),len(minus)) >= 2 min(len(plus),len(minus)) min len(plus) len plus len(minus) len minus 2 T.append([minus[0],plus[0]]) T.append T append [minus[0],plus[0]] minus[0] minus 0 plus[0] plus 0 cur = minus[0]-plus[0] cur minus[0]-plus[0] minus[0] minus 0 plus[0] plus 0 for i in range(1,len(plus)-1):
        T.append([cur,plus[i]])
        cur = cur-plus[i]
       i range(1,len(plus)-1) range 1 len(plus)-1 len(plus) len plus 1 T.append([cur,plus[i]]) T.append T append [cur,plus[i]] cur plus[i] plus i cur = cur-plus[i] cur cur-plus[i] cur plus[i] plus i T.append([plus[len(plus)-1],cur]) T.append T append [plus[len(plus)-1],cur] plus[len(plus)-1] plus len(plus)-1 len(plus) len plus 1 cur cur = plus[len(plus)-1]-cur cur plus[len(plus)-1]-cur plus[len(plus)-1] plus len(plus)-1 len(plus) len plus 1 cur for i in range(1,len(minus)):
        T.append([cur,minus[i]])
        cur = cur-minus[i]
       i range(1,len(minus)) range 1 len(minus) len minus T.append([cur,minus[i]]) T.append T append [cur,minus[i]] cur minus[i] minus i cur = cur-minus[i] cur cur-minus[i] cur minus[i] minus i print(cur) print cur for i in range(len(T)):
        print(T[i][0],T[i][1])
     i range(len(T)) range len(T) len T print(T[i][0],T[i][1]) print T[i][0] [i] T i 0 T[i][1] [i] T i 1 if len(minus) == 1:
        cur = minus[0]
        T.append([cur,plus[0]])
        cur = cur-plus[0]
        for i in range(1,len(plus)-1):
          T.append([cur,plus[i]])
          cur = cur-plus[i]
        T.append([plus[len(plus)-1],cur])
        cur = plus[len(plus)-1]-cur
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
      else:
        cur = plus[0]
        T.append([cur,minus[0]])
        cur = cur-minus[0]
        for i in range(1,len(minus)):
          T.append([cur,minus[i]])
          cur = cur-minus[i]
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
   len(minus) == 1 len(minus) len minus 1 cur = minus[0] cur minus[0] minus 0 T.append([cur,plus[0]]) T.append T append [cur,plus[0]] cur plus[0] plus 0 cur = cur-plus[0] cur cur-plus[0] cur plus[0] plus 0 for i in range(1,len(plus)-1):
          T.append([cur,plus[i]])
          cur = cur-plus[i]
         i range(1,len(plus)-1) range 1 len(plus)-1 len(plus) len plus 1 T.append([cur,plus[i]]) T.append T append [cur,plus[i]] cur plus[i] plus i cur = cur-plus[i] cur cur-plus[i] cur plus[i] plus i T.append([plus[len(plus)-1],cur]) T.append T append [plus[len(plus)-1],cur] plus[len(plus)-1] plus len(plus)-1 len(plus) len plus 1 cur cur = plus[len(plus)-1]-cur cur plus[len(plus)-1]-cur plus[len(plus)-1] plus len(plus)-1 len(plus) len plus 1 cur print(cur) print cur for i in range(len(T)):
          print(T[i][0],T[i][1])
       i range(len(T)) range len(T) len T print(T[i][0],T[i][1]) print T[i][0] [i] T i 0 T[i][1] [i] T i 1 cur = plus[0] cur plus[0] plus 0 T.append([cur,minus[0]]) T.append T append [cur,minus[0]] cur minus[0] minus 0 cur = cur-minus[0] cur cur-minus[0] cur minus[0] minus 0 for i in range(1,len(minus)):
          T.append([cur,minus[i]])
          cur = cur-minus[i]
         i range(1,len(minus)) range 1 len(minus) len minus T.append([cur,minus[i]]) T.append T append [cur,minus[i]] cur minus[i] minus i cur = cur-minus[i] cur cur-minus[i] cur minus[i] minus i print(cur) print cur for i in range(len(T)):
          print(T[i][0],T[i][1])
   i range(len(T)) range len(T) len T print(T[i][0],T[i][1]) print T[i][0] [i] T i 0 T[i][1] [i] T i 1 elif len(plus) == 0:
    cur = minus[len(minus)-1]
    for i in range(n-1):
      T.append([cur,minus[n-i-2]])
      cur = cur-minus[n-i-2]
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1])
   len(plus) == 0 len(plus) len plus 0 cur = minus[len(minus)-1] cur minus[len(minus)-1] minus len(minus)-1 len(minus) len minus 1 for i in range(n-1):
      T.append([cur,minus[n-i-2]])
      cur = cur-minus[n-i-2]
     i range(n-1) range n-1 n 1 T.append([cur,minus[n-i-2]]) T.append T append [cur,minus[n-i-2]] cur minus[n-i-2] minus n-i-2 n-i n i 2 cur = cur-minus[n-i-2] cur cur-minus[n-i-2] cur minus[n-i-2] minus n-i-2 n-i n i 2 print(cur) print cur for i in range(len(T)):
      print(T[i][0],T[i][1])
   i range(len(T)) range len(T) len T print(T[i][0],T[i][1]) print T[i][0] [i] T i 0 T[i][1] [i] T i 1 cur = plus[0] cur plus[0] plus 0 for i in range(1,n-1):
      T.append([cur,plus[i]])
      cur = cur-plus[i]
     i range(1,n-1) range 1 n-1 n 1 T.append([cur,plus[i]]) T.append T append [cur,plus[i]] cur plus[i] plus i cur = cur-plus[i] cur cur-plus[i] cur plus[i] plus i T.append([plus[n-1],cur]) T.append T append [plus[n-1],cur] plus[n-1] plus n-1 n 1 cur cur = plus[n-1]-cur cur plus[n-1]-cur plus[n-1] plus n-1 n 1 cur print(cur) print cur for i in range(len(T)):
      print(T[i][0],T[i][1]) i range(len(T)) range len(T) len T print(T[i][0],T[i][1]) print T[i][0] [i] T i 0 T[i][1] [i] T i 1 cur = cur-plus[0] cur-plus[0] cur cur = cur-minus[i] cur-minus[i] cur cur = plus[0] plus[0] cur cur = minus[0] minus[0] cur cur = cur-plus[i] cur-plus[i] cur cur = plus[n-1]-cur plus[n-1]-cur cur cur = cur-minus[n-i-2] cur-minus[n-i-2] cur plus = [] [] plus cur = plus[0] plus[0] cur n = int(input()) int(input()) n cur = minus[0]-plus[0] minus[0]-plus[0] cur cur = cur-plus[i] cur-plus[i] cur cur = cur-minus[i] cur-minus[i] cur cur = cur-plus[i] cur-plus[i] cur cur = plus[len(plus)-1]-cur plus[len(plus)-1]-cur cur T = [] [] T cur = cur-minus[0] cur-minus[0] cur L = list(map(int,input().split())) list(map(int,input().split())) L minus = [] [] minus cur = plus[len(plus)-1]-cur plus[len(plus)-1]-cur cur cur = minus[len(minus)-1] minus[len(minus)-1] cur
n = int(input())
L = list(map(int,input().split()))
L.sort()
T = []
plus = []
minus = []
for i in range(n):
  if L[i] >= 0:
    plus.append(L[i])
  else:
    minus.append(L[i])
if len(L) == 2:
  if len(plus) == len(minus):
    print(plus[0]-minus[0])
    print(plus[0],minus[0])
  elif len(plus) == 2:
    print(plus[1]-plus[0])
    print(plus[1],plus[0])
  else:
    print(minus[1]-minus[0])
    print(minus[1],minus[0])
else:
  if len(plus) != 0 and len(minus) != 0:
    if min(len(plus),len(minus)) >= 2:
      T.append([minus[0],plus[0]])
      cur = minus[0]-plus[0]
      for i in range(1,len(plus)-1):
        T.append([cur,plus[i]])
        cur = cur-plus[i]
      T.append([plus[len(plus)-1],cur])
      cur = plus[len(plus)-1]-cur
      for i in range(1,len(minus)):
        T.append([cur,minus[i]])
        cur = cur-minus[i]
      print(cur)
      for i in range(len(T)):
        print(T[i][0],T[i][1])
    else:
      if len(minus) == 1:
        cur = minus[0]
        T.append([cur,plus[0]])
        cur = cur-plus[0]
        for i in range(1,len(plus)-1):
          T.append([cur,plus[i]])
          cur = cur-plus[i]
        T.append([plus[len(plus)-1],cur])
        cur = plus[len(plus)-1]-cur
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
      else:
        cur = plus[0]
        T.append([cur,minus[0]])
        cur = cur-minus[0]
        for i in range(1,len(minus)):
          T.append([cur,minus[i]])
          cur = cur-minus[i]
        print(cur)
        for i in range(len(T)):
          print(T[i][0],T[i][1])
  elif len(plus) == 0:
    cur = minus[len(minus)-1]
    for i in range(n-1):
      T.append([cur,minus[n-i-2]])
      cur = cur-minus[n-i-2]
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1])
  else:
    cur = plus[0]
    for i in range(1,n-1):
      T.append([cur,plus[i]])
      cur = cur-plus[i]
    T.append([plus[n-1],cur])
    cur = plus[n-1]-cur
    print(cur)
    for i in range(len(T)):
      print(T[i][0],T[i][1])