n,*l=map(int,open(0).read().split())
l.sort()
i=0
ans=[]
while l[i]<0:
  i+=1
  if i==n:
    break
minus=l[:i]
plus=l[i:]
if minus and plus:
  x=minus[0]
  for y in plus[:-1]:
    ans.append((x,y))
    x-=y
  minus[0]=x
  x=plus[-1]
  for y in minus:
    ans.append((x,y))
    x-=y
elif minus:
  x=minus[-1]
  for y in minus[:-1]:
    ans.append((x,y))
    x-=y
else:
  x=plus[0]
  for y in plus[1:-1]:
    ans.append((x,y))
    x-=y
  ans.append((plus[-1],x))
  x=plus[-1]-x
print(x)
for i,j in ans:
  print(i,j) n,*l=map(int,open(0).read().split()) n map(int,open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *l l l.sort() l.sort l sort i=0 i 0 ans=[] ans [] while l[i]<0:
  i+=1
  if i==n:
    break l[i]<0 l[i] l i 0 i+=1 i 1 if i==n:
    break i==n i n break minus=l[:i] minus l[:i] l :i i plus=l[i:] plus l[i:] l i: i if minus and plus:
  x=minus[0]
  for y in plus[:-1]:
    ans.append((x,y))
    x-=y
  minus[0]=x
  x=plus[-1]
  for y in minus:
    ans.append((x,y))
    x-=y
elif minus:
  x=minus[-1]
  for y in minus[:-1]:
    ans.append((x,y))
    x-=y
else:
  x=plus[0]
  for y in plus[1:-1]:
    ans.append((x,y))
    x-=y
  ans.append((plus[-1],x))
  x=plus[-1]-x minus and plus minus plus x=minus[0] x minus[0] minus 0 for y in plus[:-1]:
    ans.append((x,y))
    x-=y
   y plus[:-1] plus :-1 -1 ans.append((x,y)) ans.append ans append (x,y) x y x-=y x y minus[0]=x minus[0] minus 0 x x=plus[-1] x plus[-1] plus -1 for y in minus:
    ans.append((x,y))
    x-=y y minus ans.append((x,y)) ans.append ans append (x,y) x y x-=y x y elif minus:
  x=minus[-1]
  for y in minus[:-1]:
    ans.append((x,y))
    x-=y minus x=minus[-1] x minus[-1] minus -1 for y in minus[:-1]:
    ans.append((x,y))
    x-=y y minus[:-1] minus :-1 -1 ans.append((x,y)) ans.append ans append (x,y) x y x-=y x y x=plus[0] x plus[0] plus 0 for y in plus[1:-1]:
    ans.append((x,y))
    x-=y
   y plus[1:-1] plus 1:-1 1 -1 ans.append((x,y)) ans.append ans append (x,y) x y x-=y x y ans.append((plus[-1],x)) ans.append ans append (plus[-1],x) plus[-1] plus -1 x x=plus[-1]-x x plus[-1]-x plus[-1] plus -1 x print(x) print x for i,j in ans:
  print(i,j) i j ans print(i,j) print i j x-=y y x x=minus[-1] minus[-1] x n,*l=map(int,open(0).read().split()) map(int,open(0).read().split()) n plus=l[i:] l[i:] plus x=minus[0] minus[0] x x-=y y x i+=1 1 i i=0 0 i x-=y y x x=plus[-1]-x plus[-1]-x x x-=y y x minus=l[:i] l[:i] minus x=plus[-1] plus[-1] x x=plus[0] plus[0] x ans=[] [] ans
n,*l=map(int,open(0).read().split())
l.sort()
i=0
ans=[]
while l[i]<0:
  i+=1
  if i==n:
    break
minus=l[:i]
plus=l[i:]
if minus and plus:
  x=minus[0]
  for y in plus[:-1]:
    ans.append((x,y))
    x-=y
  minus[0]=x
  x=plus[-1]
  for y in minus:
    ans.append((x,y))
    x-=y
elif minus:
  x=minus[-1]
  for y in minus[:-1]:
    ans.append((x,y))
    x-=y
else:
  x=plus[0]
  for y in plus[1:-1]:
    ans.append((x,y))
    x-=y
  ans.append((plus[-1],x))
  x=plus[-1]-x
print(x)
for i,j in ans:
  print(i,j)