N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=[0]*(N-1)
a=A[0]
z=A[-1]

for i in range(1,N-1):
    if A[i]>=0:
        ans[i-1]=(a,A[i])
        a-=A[i]
    else:
        ans[i-1]=(z,A[i])
        z-=A[i]
ans[N-2]=(z,a)
print(z-a)
for s in ans:
    print(*s) 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 ans=[0]*(N-1) ans [0]*(N-1) [0] 0 N-1 N 1 a=A[0] a A[0] A 0 z=A[-1] z A[-1] A -1 for i in range(1,N-1):
    if A[i]>=0:
        ans[i-1]=(a,A[i])
        a-=A[i]
    else:
        ans[i-1]=(z,A[i])
        z-=A[i] i range(1,N-1) range 1 N-1 N 1 if A[i]>=0:
        ans[i-1]=(a,A[i])
        a-=A[i]
    else:
        ans[i-1]=(z,A[i])
        z-=A[i] A[i]>=0 A[i] A i 0 ans[i-1]=(a,A[i]) ans[i-1] ans i-1 i 1 (a,A[i]) a A[i] A i a-=A[i] a A[i] A i ans[i-1]=(z,A[i]) ans[i-1] ans i-1 i 1 (z,A[i]) z A[i] A i z-=A[i] z A[i] A i ans[N-2]=(z,a) ans[N-2] ans N-2 N 2 (z,a) z a print(z-a) print z-a z a for s in ans:
    print(*s) s ans print(*s) print *s s ans=[0]*(N-1) [0]*(N-1) ans a=A[0] A[0] a z-=A[i] A[i] z A=list(map(int,input().split())) list(map(int,input().split())) A z=A[-1] A[-1] z N=int(input()) int(input()) N a-=A[i] A[i] a
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=[0]*(N-1)
a=A[0]
z=A[-1]

for i in range(1,N-1):
    if A[i]>=0:
        ans[i-1]=(a,A[i])
        a-=A[i]
    else:
        ans[i-1]=(z,A[i])
        z-=A[i]
ans[N-2]=(z,a)
print(z-a)
for s in ans:
    print(*s)