n= int(input())
a = list(map(int,input().split()))
xy = []
xyap = xy.append
ap = max(a)
a.remove(ap)
am = min(a)
a.remove(am)
for i in a:
  if i>0:
    xyap((am,i))
    am -= i
  else:
    xyap((ap,i))
    ap -= i
xyap((ap,am))
print(ap-am)
for i in xy:
  print(*i) 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 xy = [] xy [] xyap = xy.append xyap xy.append xy append ap = max(a) ap max(a) max a a.remove(ap) a.remove a remove ap am = min(a) am min(a) min a a.remove(am) a.remove a remove am for i in a:
  if i>0:
    xyap((am,i))
    am -= i
  else:
    xyap((ap,i))
    ap -= i i a if i>0:
    xyap((am,i))
    am -= i
  else:
    xyap((ap,i))
    ap -= i i>0 i 0 xyap((am,i)) xyap (am,i) am i am -= i am i xyap((ap,i)) xyap (ap,i) ap i ap -= i ap i xyap((ap,am)) xyap (ap,am) ap am print(ap-am) print ap-am ap am for i in xy:
  print(*i) i xy print(*i) print *i i n= int(input()) int(input()) n a = list(map(int,input().split())) list(map(int,input().split())) a xy = [] [] xy xyap = xy.append xy.append xyap am = min(a) min(a) am am -= i i am ap = max(a) max(a) ap ap -= i i ap
n= int(input())
a = list(map(int,input().split()))
xy = []
xyap = xy.append
ap = max(a)
a.remove(ap)
am = min(a)
a.remove(am)
for i in a:
  if i>0:
    xyap((am,i))
    am -= i
  else:
    xyap((ap,i))
    ap -= i
xyap((ap,am))
print(ap-am)
for i in xy:
  print(*i)