n=int(input())
a=list(map(int,input().split()))
a.sort()
import bisect 
if a[0]*a[-1]<0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[0]
  t=bisect.bisect_right(a,0)
  for i in range(t+1,n):
    print(tmp,a[i])
    tmp-=a[i]
  a[0]=tmp
  tmp=a[t]
  for i in range(t-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(tmp,a[t-1])

elif a[0]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp)
elif a[-1]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[-1]
  for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i]

elif a[0]>0:
  print(sum(a)-2*a[0])
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp)
else:
  print(abs(sum(a))+2*a[-1])
  tmp=a[-1]
  for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[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 a.sort() a.sort a sort import bisect bisect if a[0]*a[-1]<0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[0]
  t=bisect.bisect_right(a,0)
  for i in range(t+1,n):
    print(tmp,a[i])
    tmp-=a[i]
  a[0]=tmp
  tmp=a[t]
  for i in range(t-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(tmp,a[t-1])

elif a[0]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp)
elif a[-1]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[-1]
  for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i]

elif a[0]>0:
  print(sum(a)-2*a[0])
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp)
else:
  print(abs(sum(a))+2*a[-1])
  tmp=a[-1]
  for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i] a[0]*a[-1]<0 a[0]*a[-1] a[0] a 0 a[-1] a -1 0 abs(x) for x in a for x in a x a for x in a abs(x) abs x print(abs(sum([abs(x) for x in a]))) print abs(sum([abs(x) for x in a])) abs sum([abs(x) for x in a]) sum [abs(x) for x in a] tmp=a[0] tmp a[0] a 0 t=bisect.bisect_right(a,0) t bisect.bisect_right(a,0) bisect.bisect_right bisect bisect_right a 0 for i in range(t+1,n):
    print(tmp,a[i])
    tmp-=a[i]
   i range(t+1,n) range t+1 t 1 n print(tmp,a[i]) print tmp a[i] a i tmp-=a[i] tmp a[i] a i a[0]=tmp a[0] a 0 tmp tmp=a[t] tmp a[t] a t for i in range(t-1):
    print(tmp,a[i])
    tmp-=a[i]
   i range(t-1) range t-1 t 1 print(tmp,a[i]) print tmp a[i] a i tmp-=a[i] tmp a[i] a i print(tmp,a[t-1]) print tmp a[t-1] a t-1 t 1 elif a[0]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp) a[0]==0 a[0] a 0 0 abs(x) for x in a for x in a x a for x in a abs(x) abs x print(abs(sum([abs(x) for x in a]))) print abs(sum([abs(x) for x in a])) abs sum([abs(x) for x in a]) sum [abs(x) for x in a] tmp=a[0] tmp a[0] a 0 for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
   i range(1,n-1) range 1 n-1 n 1 print(tmp,a[i]) print tmp a[i] a i tmp-=a[i] tmp a[i] a i print(a[-1],tmp) print a[-1] a -1 tmp elif a[-1]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[-1]
  for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i] a[-1]==0 a[-1] a -1 0 abs(x) for x in a for x in a x a for x in a abs(x) abs x print(abs(sum([abs(x) for x in a]))) print abs(sum([abs(x) for x in a])) abs sum([abs(x) for x in a]) sum [abs(x) for x in a] tmp=a[-1] tmp a[-1] a -1 for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i] i range(n-2,-1,-1) range n-2 n 2 -1 -1 print(tmp,a[i]) print tmp a[i] a i tmp-=a[i] tmp a[i] a i elif a[0]>0:
  print(sum(a)-2*a[0])
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp) a[0]>0 a[0] a 0 0 print(sum(a)-2*a[0]) print sum(a)-2*a[0] sum(a) sum a 2*a[0] 2 a[0] a 0 tmp=a[0] tmp a[0] a 0 for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
   i range(1,n-1) range 1 n-1 n 1 print(tmp,a[i]) print tmp a[i] a i tmp-=a[i] tmp a[i] a i print(a[-1],tmp) print a[-1] a -1 tmp print(abs(sum(a))+2*a[-1]) print abs(sum(a))+2*a[-1] abs(sum(a)) abs sum(a) sum a 2*a[-1] 2 a[-1] a -1 tmp=a[-1] tmp a[-1] a -1 for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i] i range(n-2,-1,-1) range n-2 n 2 -1 -1 print(tmp,a[i]) print tmp a[i] a i tmp-=a[i] tmp a[i] a i tmp=a[0] a[0] tmp tmp-=a[i] a[i] tmp tmp=a[0] a[0] tmp tmp=a[-1] a[-1] tmp tmp=a[t] a[t] tmp tmp-=a[i] a[i] tmp tmp-=a[i] a[i] tmp tmp-=a[i] a[i] tmp a=list(map(int,input().split())) list(map(int,input().split())) a tmp-=a[i] a[i] tmp tmp-=a[i] a[i] tmp t=bisect.bisect_right(a,0) bisect.bisect_right(a,0) t n=int(input()) int(input()) n tmp=a[0] a[0] tmp tmp=a[-1] a[-1] tmp
n=int(input())
a=list(map(int,input().split()))
a.sort()
import bisect 
if a[0]*a[-1]<0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[0]
  t=bisect.bisect_right(a,0)
  for i in range(t+1,n):
    print(tmp,a[i])
    tmp-=a[i]
  a[0]=tmp
  tmp=a[t]
  for i in range(t-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(tmp,a[t-1])

elif a[0]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp)
elif a[-1]==0:
  print(abs(sum([abs(x) for x in a])))
  tmp=a[-1]
  for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i]

elif a[0]>0:
  print(sum(a)-2*a[0])
  tmp=a[0]
  for i in range(1,n-1):
    print(tmp,a[i])
    tmp-=a[i]
  print(a[-1],tmp)
else:
  print(abs(sum(a))+2*a[-1])
  tmp=a[-1]
  for i in range(n-2,-1,-1):
    print(tmp,a[i])
    tmp-=a[i]
