n,*a=map(int,open(0).read().split())

plus=[]
minus=[]
for aa in a:
    if aa>=0:
        plus.append(aa)
    else:
        minus.append(aa)

if len(plus)==n:
    plus.sort(reverse=True)
    minus.append(plus.pop())
elif len(minus)==n:
    minus.sort()
    plus.append(minus.pop())

print(sum(plus)-sum(minus))

xy=minus[0]
for i in range(len(plus)-1):
    print('{} {}'.format(xy,plus[i]))
    xy-=plus[i]

print('{} {}'.format(plus[-1],xy))
xy=plus[-1]-xy

for i in range(1,len(minus)):
    print('{} {}'.format(xy,minus[i]))
    xy-=minus[i]
 n,*a=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 *a a plus=[] plus [] minus=[] minus [] for aa in a:
    if aa>=0:
        plus.append(aa)
    else:
        minus.append(aa) aa a if aa>=0:
        plus.append(aa)
    else:
        minus.append(aa) aa>=0 aa 0 plus.append(aa) plus.append plus append aa minus.append(aa) minus.append minus append aa if len(plus)==n:
    plus.sort(reverse=True)
    minus.append(plus.pop())
elif len(minus)==n:
    minus.sort()
    plus.append(minus.pop()) len(plus)==n len(plus) len plus n plus.sort(reverse=True) plus.sort plus sort reverse=True reverse True minus.append(plus.pop()) minus.append minus append plus.pop() plus.pop plus pop elif len(minus)==n:
    minus.sort()
    plus.append(minus.pop()) len(minus)==n len(minus) len minus n minus.sort() minus.sort minus sort plus.append(minus.pop()) plus.append plus append minus.pop() minus.pop minus pop print(sum(plus)-sum(minus)) print sum(plus)-sum(minus) sum(plus) sum plus sum(minus) sum minus xy=minus[0] xy minus[0] minus 0 for i in range(len(plus)-1):
    print('{} {}'.format(xy,plus[i]))
    xy-=plus[i] i range(len(plus)-1) range len(plus)-1 len(plus) len plus 1 print('{} {}'.format(xy,plus[i])) print '{} {}'.format(xy,plus[i]) '{} {}'.format '{} {}' format xy plus[i] plus i xy-=plus[i] xy plus[i] plus i print('{} {}'.format(plus[-1],xy)) print '{} {}'.format(plus[-1],xy) '{} {}'.format '{} {}' format plus[-1] plus -1 xy xy=plus[-1]-xy xy plus[-1]-xy plus[-1] plus -1 xy for i in range(1,len(minus)):
    print('{} {}'.format(xy,minus[i]))
    xy-=minus[i] i range(1,len(minus)) range 1 len(minus) len minus print('{} {}'.format(xy,minus[i])) print '{} {}'.format(xy,minus[i]) '{} {}'.format '{} {}' format xy minus[i] minus i xy-=minus[i] xy minus[i] minus i plus=[] [] plus minus=[] [] minus xy=minus[0] minus[0] xy n,*a=map(int,open(0).read().split()) map(int,open(0).read().split()) n xy=plus[-1]-xy plus[-1]-xy xy xy-=plus[i] plus[i] xy xy-=minus[i] minus[i] xy
n,*a=map(int,open(0).read().split())

plus=[]
minus=[]
for aa in a:
    if aa>=0:
        plus.append(aa)
    else:
        minus.append(aa)

if len(plus)==n:
    plus.sort(reverse=True)
    minus.append(plus.pop())
elif len(minus)==n:
    minus.sort()
    plus.append(minus.pop())

print(sum(plus)-sum(minus))

xy=minus[0]
for i in range(len(plus)-1):
    print('{} {}'.format(xy,plus[i]))
    xy-=plus[i]

print('{} {}'.format(plus[-1],xy))
xy=plus[-1]-xy

for i in range(1,len(minus)):
    print('{} {}'.format(xy,minus[i]))
    xy-=minus[i]

