n=int(input())
a=list(map(int,input().split()))
a.sort()
hu=0
for b in a:
    if b<0:
        hu+=1
    else:
        break
if hu==0:
    hu=1
if hu==n:
    hu=n-1
ansl=[]
nowl=a[0]
for i in range(hu,n-1):
    ansl.append((nowl,a[i]))
    nowl-=a[i]

nowr=a[n-1]
for i in range(1,hu):
    ansl.append((nowr,a[i]))
    nowr-=a[i]

ansl.append((nowr,nowl))
print(nowr-nowl)
for i in range(n-1):
    x,y=ansl[i]
    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 hu=0 hu 0 for b in a:
    if b<0:
        hu+=1
    else:
        break b a if b<0:
        hu+=1
    else:
        break b<0 b 0 hu+=1 hu 1 break if hu==0:
    hu=1 hu==0 hu 0 hu=1 hu 1 if hu==n:
    hu=n-1 hu==n hu n hu=n-1 hu n-1 n 1 ansl=[] ansl [] nowl=a[0] nowl a[0] a 0 for i in range(hu,n-1):
    ansl.append((nowl,a[i]))
    nowl-=a[i] i range(hu,n-1) range hu n-1 n 1 ansl.append((nowl,a[i])) ansl.append ansl append (nowl,a[i]) nowl a[i] a i nowl-=a[i] nowl a[i] a i nowr=a[n-1] nowr a[n-1] a n-1 n 1 for i in range(1,hu):
    ansl.append((nowr,a[i]))
    nowr-=a[i] i range(1,hu) range 1 hu ansl.append((nowr,a[i])) ansl.append ansl append (nowr,a[i]) nowr a[i] a i nowr-=a[i] nowr a[i] a i ansl.append((nowr,nowl)) ansl.append ansl append (nowr,nowl) nowr nowl print(nowr-nowl) print nowr-nowl nowr nowl for i in range(n-1):
    x,y=ansl[i]
    print(x,y) i range(n-1) range n-1 n 1 x,y=ansl[i] x ansl[i] ansl i y print(x,y) print x y ansl=[] [] ansl a=list(map(int,input().split())) list(map(int,input().split())) a hu=0 0 hu x,y=ansl[i] ansl[i] x hu=1 1 hu n=int(input()) int(input()) n nowl-=a[i] a[i] nowl nowl=a[0] a[0] nowl nowr-=a[i] a[i] nowr hu+=1 1 hu y=ansl[i] ansl[i] y hu=n-1 n-1 hu nowr=a[n-1] a[n-1] nowr
n=int(input())
a=list(map(int,input().split()))
a.sort()
hu=0
for b in a:
    if b<0:
        hu+=1
    else:
        break
if hu==0:
    hu=1
if hu==n:
    hu=n-1
ansl=[]
nowl=a[0]
for i in range(hu,n-1):
    ansl.append((nowl,a[i]))
    nowl-=a[i]

nowr=a[n-1]
for i in range(1,hu):
    ansl.append((nowr,a[i]))
    nowr-=a[i]

ansl.append((nowr,nowl))
print(nowr-nowl)
for i in range(n-1):
    x,y=ansl[i]
    print(x,y)
