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