n=int(input())
a=[int(j) for j in input().split()]
a.sort()
ans=[]
p=a[0]
q=a[-1]
for i in a[1:-1]:
    if i<0:
        ans.append([q,i])
        q-=i
    else:
        ans.append([p,i])
        p-=i
ans.append([q,p])
print(q-p)
for i,j in ans:
    print(i,j) n=int(input()) n int(input()) int input() input int(j) for j in input().split() for j in input().split() j input().split() ().split () input split for j in input().split() int(j) int j a=[int(j) for j in input().split()] a [int(j) for j in input().split()] a.sort() a.sort a sort ans=[] ans [] p=a[0] p a[0] a 0 q=a[-1] q a[-1] a -1 for i in a[1:-1]:
    if i<0:
        ans.append([q,i])
        q-=i
    else:
        ans.append([p,i])
        p-=i i a[1:-1] a 1:-1 1 -1 if i<0:
        ans.append([q,i])
        q-=i
    else:
        ans.append([p,i])
        p-=i i<0 i 0 ans.append([q,i]) ans.append ans append [q,i] q i q-=i q i ans.append([p,i]) ans.append ans append [p,i] p i p-=i p i ans.append([q,p]) ans.append ans append [q,p] q p print(q-p) print q-p q p for i,j in ans:
    print(i,j) i j ans print(i,j) print i j q-=i i q q=a[-1] a[-1] q n=int(input()) int(input()) n p-=i i p p=a[0] a[0] p ans=[] [] ans a=[int(j) for j in input().split()] [int(j) for j in input().split()] a
n=int(input())
a=[int(j) for j in input().split()]
a.sort()
ans=[]
p=a[0]
q=a[-1]
for i in a[1:-1]:
    if i<0:
        ans.append([q,i])
        q-=i
    else:
        ans.append([p,i])
        p-=i
ans.append([q,p])
print(q-p)
for i,j in ans:
    print(i,j)
