n,a=int(input()),sorted(list(map(int,input().split())))
mn,mx=a[0],a[-1]
for i in a[1:-1]:
  if i<0:mx-=i
  else:mn-=i
print(mx-mn)
mn,mx=a[0],a[-1]
for i in a[1:-1]:
  if i<0:print(mx,i);mx-=i
  else:print(mn,i);mn-=i
print(mx,mn) n,a=int(input()),sorted(list(map(int,input().split()))) n int(input()) int input() input a sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split mn,mx=a[0],a[-1] mn a[0] a 0 mx a[-1] a -1 for i in a[1:-1]:
  if i<0:mx-=i
  else:mn-=i i a[1:-1] a 1:-1 1 -1 if i<0:mx-=i
  else:mn-=i i<0 i 0 print(mx-mn) print mx-mn mx mn mn,mx=a[0],a[-1] mn a[0] a 0 mx a[-1] a -1 for i in a[1:-1]:
  if i<0:print(mx,i);mx-=i
  else:print(mn,i);mn-=i i a[1:-1] a 1:-1 1 -1 if i<0:print(mx,i);mx-=i
  else:print(mn,i);mn-=i i<0 i 0 print(mx,mn) print mx mn mx=a[0],a[-1] a[-1] mx mx=a[0],a[-1] a[-1] mx a=int(input()),sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) a mn,mx=a[0],a[-1] a[0] mn n,a=int(input()),sorted(list(map(int,input().split()))) int(input()) n mn,mx=a[0],a[-1] a[0] mn
n,a=int(input()),sorted(list(map(int,input().split())))
mn,mx=a[0],a[-1]
for i in a[1:-1]:
  if i<0:mx-=i
  else:mn-=i
print(mx-mn)
mn,mx=a[0],a[-1]
for i in a[1:-1]:
  if i<0:print(mx,i);mx-=i
  else:print(mn,i);mn-=i
print(mx,mn)
