n,*a=map(int,open(0).read().split())
a.sort()
u,d=a[-1],a[0]
print(sum(abs(i)for i in a)-2*min(abs(u),abs(d))*(u*d>0))
for i in a[1:-1]:
    if i<0:print(u,i);u-=i
    else:print(d,i);d-=i
print(u,d) 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 a.sort() a.sort a sort u,d=a[-1],a[0] u a[-1] a -1 d a[0] a 0 print(sum(abs(i)for i in a)-2*min(abs(u),abs(d))*(u*d>0)) print sum(abs(i)for i in a)-2*min(abs(u),abs(d))*(u*d>0) sum(abs(i)for i in a) sum abs(i) abs i 2*min(abs(u),abs(d))*(u*d>0) 2*min(abs(u),abs(d)) 2 min(abs(u),abs(d)) min abs(u) abs u abs(d) abs d u*d>0 u*d u d 0 for i in a[1:-1]:
    if i<0:print(u,i);u-=i
    else:print(d,i);d-=i i a[1:-1] a 1:-1 1 -1 if i<0:print(u,i);u-=i
    else:print(d,i);d-=i i<0 i 0 print(u,d) print u d d=a[-1],a[0] a[0] d n,*a=map(int,open(0).read().split()) map(int,open(0).read().split()) n u,d=a[-1],a[0] a[-1] u
n,*a=map(int,open(0).read().split())
a.sort()
u,d=a[-1],a[0]
print(sum(abs(i)for i in a)-2*min(abs(u),abs(d))*(u*d>0))
for i in a[1:-1]:
    if i<0:print(u,i);u-=i
    else:print(d,i);d-=i
print(u,d)