n=int(input())
a=list(map(int,input().split()))
a.sort()
l=[a[0]]
r=[a[-1]]
for i in range(1,n-1):
    if a[i]<=0:
        r.append(a[i])
    else:
        l.append(a[i])
r.sort()
l.sort()
if len(r)==1:
    X=r[0]
    p=[]
else:
    p=[[r[-1],r[-2]]]
    for i in range(len(r)-3,-1,-1):
        p.append([p[-1][0]-p[-1][1],r[i]])
    X=p[-1][0]-p[-1][1]
if len(l)==1:
    Y=l[0]
    q=[]
else:
    q=[[l[0],l[1]]]
    for i in range(2,len(l)):
        q.append([q[-1][0]-q[-1][1],l[i]])
    Y=q[-1][0]-q[-1][1]
print(X-Y)
if p and q:
    for i in range(len(p)):
        print(*p[i])
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
elif p:
    for i in range(len(p)):
        print(*p[i])
    print(X,Y)
elif q:
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
else:
    print(X,Y) n=int(input()) n int(input()) int input() input a=list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split a.sort() a.sort a sort l=[a[0]] l [a[0]] a[0] a 0 r=[a[-1]] r [a[-1]] a[-1] a -1 for i in range(1,n-1):
    if a[i]<=0:
        r.append(a[i])
    else:
        l.append(a[i]) i range(1,n-1) range 1 n-1 n 1 if a[i]<=0:
        r.append(a[i])
    else:
        l.append(a[i]) a[i]<=0 a[i] a i 0 r.append(a[i]) r.append r append a[i] a i l.append(a[i]) l.append l append a[i] a i r.sort() r.sort r sort l.sort() l.sort l sort if len(r)==1:
    X=r[0]
    p=[]
else:
    p=[[r[-1],r[-2]]]
    for i in range(len(r)-3,-1,-1):
        p.append([p[-1][0]-p[-1][1],r[i]])
    X=p[-1][0]-p[-1][1] len(r)==1 len(r) len r 1 X=r[0] X r[0] r 0 p=[] p [] p=[[r[-1],r[-2]]] p [[r[-1],r[-2]]] [r[-1],r[-2]] r[-1] r -1 r[-2] r -2 for i in range(len(r)-3,-1,-1):
        p.append([p[-1][0]-p[-1][1],r[i]])
     i range(len(r)-3,-1,-1) range len(r)-3 len(r) len r 3 -1 -1 p.append([p[-1][0]-p[-1][1],r[i]]) p.append p append [p[-1][0]-p[-1][1],r[i]] p[-1][0]-p[-1][1] p[-1][0] [-1] p -1 0 p[-1][1] [-1] p -1 1 r[i] r i X=p[-1][0]-p[-1][1] X p[-1][0]-p[-1][1] p[-1][0] [-1] p -1 0 p[-1][1] [-1] p -1 1 if len(l)==1:
    Y=l[0]
    q=[]
else:
    q=[[l[0],l[1]]]
    for i in range(2,len(l)):
        q.append([q[-1][0]-q[-1][1],l[i]])
    Y=q[-1][0]-q[-1][1] len(l)==1 len(l) len l 1 Y=l[0] Y l[0] l 0 q=[] q [] q=[[l[0],l[1]]] q [[l[0],l[1]]] [l[0],l[1]] l[0] l 0 l[1] l 1 for i in range(2,len(l)):
        q.append([q[-1][0]-q[-1][1],l[i]])
     i range(2,len(l)) range 2 len(l) len l q.append([q[-1][0]-q[-1][1],l[i]]) q.append q append [q[-1][0]-q[-1][1],l[i]] q[-1][0]-q[-1][1] q[-1][0] [-1] q -1 0 q[-1][1] [-1] q -1 1 l[i] l i Y=q[-1][0]-q[-1][1] Y q[-1][0]-q[-1][1] q[-1][0] [-1] q -1 0 q[-1][1] [-1] q -1 1 print(X-Y) print X-Y X Y if p and q:
    for i in range(len(p)):
        print(*p[i])
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
elif p:
    for i in range(len(p)):
        print(*p[i])
    print(X,Y)
elif q:
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
else:
    print(X,Y) p and q p q for i in range(len(p)):
        print(*p[i])
     i range(len(p)) range len(p) len p print(*p[i]) print *p[i] p[i] p i for i in range(len(q)):
        print(*q[i])
     i range(len(q)) range len(q) len q print(*q[i]) print *q[i] q[i] q i print(X,Y) print X Y elif p:
    for i in range(len(p)):
        print(*p[i])
    print(X,Y) p for i in range(len(p)):
        print(*p[i])
     i range(len(p)) range len(p) len p print(*p[i]) print *p[i] p[i] p i print(X,Y) print X Y elif q:
    for i in range(len(q)):
        print(*q[i])
    print(X,Y) q for i in range(len(q)):
        print(*q[i])
     i range(len(q)) range len(q) len q print(*q[i]) print *q[i] q[i] q i print(X,Y) print X Y print(X,Y) print X Y n=int(input()) int(input()) n a=list(map(int,input().split())) list(map(int,input().split())) a r=[a[-1]] [a[-1]] r Y=l[0] l[0] Y X=p[-1][0]-p[-1][1] p[-1][0]-p[-1][1] X p=[] [] p l=[a[0]] [a[0]] l Y=q[-1][0]-q[-1][1] q[-1][0]-q[-1][1] Y X=r[0] r[0] X q=[[l[0],l[1]]] [[l[0],l[1]]] q p=[[r[-1],r[-2]]] [[r[-1],r[-2]]] p q=[] [] q
n=int(input())
a=list(map(int,input().split()))
a.sort()
l=[a[0]]
r=[a[-1]]
for i in range(1,n-1):
    if a[i]<=0:
        r.append(a[i])
    else:
        l.append(a[i])
r.sort()
l.sort()
if len(r)==1:
    X=r[0]
    p=[]
else:
    p=[[r[-1],r[-2]]]
    for i in range(len(r)-3,-1,-1):
        p.append([p[-1][0]-p[-1][1],r[i]])
    X=p[-1][0]-p[-1][1]
if len(l)==1:
    Y=l[0]
    q=[]
else:
    q=[[l[0],l[1]]]
    for i in range(2,len(l)):
        q.append([q[-1][0]-q[-1][1],l[i]])
    Y=q[-1][0]-q[-1][1]
print(X-Y)
if p and q:
    for i in range(len(p)):
        print(*p[i])
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
elif p:
    for i in range(len(p)):
        print(*p[i])
    print(X,Y)
elif q:
    for i in range(len(q)):
        print(*q[i])
    print(X,Y)
else:
    print(X,Y)