import sys
sys.setrecursionlimit(10**7)
#n,m=map(int,input().split())
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
if a[-1]<=0:
    x=a.pop()
    print(x-sum(a))
    for y in a:
        print(x,y)
        x=x-y
elif a[0]>=0:
    a=a[::-1]
    x=a.pop()
    print(-x+sum(a))
    while a:
        y=a.pop()
        if len(a)>0:
            print(x,y)
            x=x-y
        else:
            print(y,x)
            
else:
    for i in range(n):
        if a[i]>0:
            ap=a[i:]
            an=a[:i]
            break
    print(sum(ap)-sum(an))
    z=ap.pop()
    x=an.pop()
    for y in ap:
        print(x,y)
        x=x-y
    for y in an:
        print(z,y)
        z=z-y
    print(z,x) import sys sys sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 n=int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a=[int(i) for i in input().split()] a [int(i) for i in input().split()] a.sort() a.sort a sort if a[-1]<=0:
    x=a.pop()
    print(x-sum(a))
    for y in a:
        print(x,y)
        x=x-y
elif a[0]>=0:
    a=a[::-1]
    x=a.pop()
    print(-x+sum(a))
    while a:
        y=a.pop()
        if len(a)>0:
            print(x,y)
            x=x-y
        else:
            print(y,x)
            
else:
    for i in range(n):
        if a[i]>0:
            ap=a[i:]
            an=a[:i]
            break
    print(sum(ap)-sum(an))
    z=ap.pop()
    x=an.pop()
    for y in ap:
        print(x,y)
        x=x-y
    for y in an:
        print(z,y)
        z=z-y
    print(z,x) a[-1]<=0 a[-1] a -1 0 x=a.pop() x a.pop() a.pop a pop print(x-sum(a)) print x-sum(a) x sum(a) sum a for y in a:
        print(x,y)
        x=x-y y a print(x,y) print x y x=x-y x x-y x y elif a[0]>=0:
    a=a[::-1]
    x=a.pop()
    print(-x+sum(a))
    while a:
        y=a.pop()
        if len(a)>0:
            print(x,y)
            x=x-y
        else:
            print(y,x)
             a[0]>=0 a[0] a 0 0 a=a[::-1] a a[::-1] a ::-1 -1 x=a.pop() x a.pop() a.pop a pop print(-x+sum(a)) print -x+sum(a) -x x sum(a) sum a while a:
        y=a.pop()
        if len(a)>0:
            print(x,y)
            x=x-y
        else:
            print(y,x)
             a y=a.pop() y a.pop() a.pop a pop if len(a)>0:
            print(x,y)
            x=x-y
        else:
            print(y,x)
             len(a)>0 len(a) len a 0 print(x,y) print x y x=x-y x x-y x y print(y,x) print y x for i in range(n):
        if a[i]>0:
            ap=a[i:]
            an=a[:i]
            break
     i range(n) range n if a[i]>0:
            ap=a[i:]
            an=a[:i]
            break
     a[i]>0 a[i] a i 0 ap=a[i:] ap a[i:] a i: i an=a[:i] an a[:i] a :i i break print(sum(ap)-sum(an)) print sum(ap)-sum(an) sum(ap) sum ap sum(an) sum an z=ap.pop() z ap.pop() ap.pop ap pop x=an.pop() x an.pop() an.pop an pop for y in ap:
        print(x,y)
        x=x-y
     y ap print(x,y) print x y x=x-y x x-y x y for y in an:
        print(z,y)
        z=z-y
     y an print(z,y) print z y z=z-y z z-y z y print(z,x) print z x x=x-y x-y x x=x-y x-y x x=an.pop() an.pop() x a=a[::-1] a[::-1] a x=a.pop() a.pop() x a=[int(i) for i in input().split()] [int(i) for i in input().split()] a z=ap.pop() ap.pop() z an=a[:i] a[:i] an x=x-y x-y x n=int(input()) int(input()) n ap=a[i:] a[i:] ap y=a.pop() a.pop() y x=a.pop() a.pop() x z=z-y z-y z
import sys
sys.setrecursionlimit(10**7)
#n,m=map(int,input().split())
n=int(input())
a=[int(i) for i in input().split()]
a.sort()
if a[-1]<=0:
    x=a.pop()
    print(x-sum(a))
    for y in a:
        print(x,y)
        x=x-y
elif a[0]>=0:
    a=a[::-1]
    x=a.pop()
    print(-x+sum(a))
    while a:
        y=a.pop()
        if len(a)>0:
            print(x,y)
            x=x-y
        else:
            print(y,x)
            
else:
    for i in range(n):
        if a[i]>0:
            ap=a[i:]
            an=a[:i]
            break
    print(sum(ap)-sum(an))
    z=ap.pop()
    x=an.pop()
    for y in ap:
        print(x,y)
        x=x-y
    for y in an:
        print(z,y)
        z=z-y
    print(z,x)
