N = int(input())
A = [int(a) for a in input().split()]

ans = []
A.sort()
if A[0] >= 0:
    ans.append([A[0], A[1]])
    A[1] = A[0]-A[1]
    A.pop(0)
elif A[-1] <= 0:
    ans.append([A[-1], A[-2]])
    A[-2] = A[-1]-A[-2]
    A.pop(N-1)
for i in range(1, len(A)-1):
    if A[i] < 0:
        ans.append([A[-1], A[i]])
        A[-1] -= A[i]
    else:
        ans.append([A[0], A[i]])
        A[0] -= A[i]
if N > 2:
    ans.append([A[-1], A[0]])
print(A[-1]-A[0])
for a in ans:
    print(*a) N = int(input()) N int(input()) int input() input int(a) for a in input().split() for a in input().split() a input().split() ().split () input split for a in input().split() int(a) int a A = [int(a) for a in input().split()] A [int(a) for a in input().split()] ans = [] ans [] A.sort() A.sort A sort if A[0] >= 0:
    ans.append([A[0], A[1]])
    A[1] = A[0]-A[1]
    A.pop(0)
elif A[-1] <= 0:
    ans.append([A[-1], A[-2]])
    A[-2] = A[-1]-A[-2]
    A.pop(N-1) A[0] >= 0 A[0] A 0 0 ans.append([A[0], A[1]]) ans.append ans append [A[0], A[1]] A[0] A 0 A[1] A 1 A[1] = A[0]-A[1] A[1] A 1 A[0]-A[1] A[0] A 0 A[1] A 1 A.pop(0) A.pop A pop 0 elif A[-1] <= 0:
    ans.append([A[-1], A[-2]])
    A[-2] = A[-1]-A[-2]
    A.pop(N-1) A[-1] <= 0 A[-1] A -1 0 ans.append([A[-1], A[-2]]) ans.append ans append [A[-1], A[-2]] A[-1] A -1 A[-2] A -2 A[-2] = A[-1]-A[-2] A[-2] A -2 A[-1]-A[-2] A[-1] A -1 A[-2] A -2 A.pop(N-1) A.pop A pop N-1 N 1 for i in range(1, len(A)-1):
    if A[i] < 0:
        ans.append([A[-1], A[i]])
        A[-1] -= A[i]
    else:
        ans.append([A[0], A[i]])
        A[0] -= A[i] i range(1, len(A)-1) range 1 len(A)-1 len(A) len A 1 if A[i] < 0:
        ans.append([A[-1], A[i]])
        A[-1] -= A[i]
    else:
        ans.append([A[0], A[i]])
        A[0] -= A[i] A[i] < 0 A[i] A i 0 ans.append([A[-1], A[i]]) ans.append ans append [A[-1], A[i]] A[-1] A -1 A[i] A i A[-1] -= A[i] A[-1] A -1 A[i] A i ans.append([A[0], A[i]]) ans.append ans append [A[0], A[i]] A[0] A 0 A[i] A i A[0] -= A[i] A[0] A 0 A[i] A i if N > 2:
    ans.append([A[-1], A[0]]) N > 2 N 2 ans.append([A[-1], A[0]]) ans.append ans append [A[-1], A[0]] A[-1] A -1 A[0] A 0 print(A[-1]-A[0]) print A[-1]-A[0] A[-1] A -1 A[0] A 0 for a in ans:
    print(*a) a ans print(*a) print *a a ans = [] [] ans A = [int(a) for a in input().split()] [int(a) for a in input().split()] A N = int(input()) int(input()) N
N = int(input())
A = [int(a) for a in input().split()]

ans = []
A.sort()
if A[0] >= 0:
    ans.append([A[0], A[1]])
    A[1] = A[0]-A[1]
    A.pop(0)
elif A[-1] <= 0:
    ans.append([A[-1], A[-2]])
    A[-2] = A[-1]-A[-2]
    A.pop(N-1)
for i in range(1, len(A)-1):
    if A[i] < 0:
        ans.append([A[-1], A[i]])
        A[-1] -= A[i]
    else:
        ans.append([A[0], A[i]])
        A[0] -= A[i]
if N > 2:
    ans.append([A[-1], A[0]])
print(A[-1]-A[0])
for a in ans:
    print(*a)