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