from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().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) from sys import stdin N = int(stdin.readline().rstrip()) N int(stdin.readline().rstrip()) int stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip int(x) for x in stdin.readline().rstrip().split() for x in stdin.readline().rstrip().split() x stdin.readline().rstrip().split() stdin.readline().rstrip().split stdin.readline().rstrip() stdin.readline().rstrip stdin.readline() stdin.readline stdin readline rstrip split for x in stdin.readline().rstrip().split() int(x) int x A = [int(x) for x in stdin.readline().rstrip().split()] A [int(x) for x in stdin.readline().rstrip().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 p -= i i p N = int(stdin.readline().rstrip()) int(stdin.readline().rstrip()) N p = A[0] A[0] p q = A[-1] A[-1] q q -= i i q A = [int(x) for x in stdin.readline().rstrip().split()] [int(x) for x in stdin.readline().rstrip().split()] A ans = [] [] ans
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().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)