def all_pos(lst):
    for e in lst:
        if e < 0:
            return False
    return True

def all_neg(lst):
    for e in lst:
        if e > 0:
            return False
    return True

N = int(input())
A = list(map(int, input().split()))

ans = []
M = 0
if all_pos(A):
    A.sort()
    res = A[0]
    for i in range(1, N - 1):
        ans.append((res, A[i]))
        res -= A[i]
    ans.append((A[-1], res))
    M = A[-1] - res
elif all_neg(A):
    A.sort()
    A.reverse()
    res = A[0]
    for i in range(1, N):
        ans.append((res, A[i]))
        res -= A[i]
    M = res
else:
    A.sort()
    A.reverse()
    tmp_neg = A[-1]
    tmp_pos = A[0]
    for i in range(1, len(A) - 1):
        if A[i] >= 0:
            ans.append((tmp_neg, A[i]))
            tmp_neg -= A[i]
        else:
            ans.append((tmp_pos, A[i]))
            tmp_pos -= A[i]
    ans.append((tmp_pos, tmp_neg))
    M = tmp_pos - tmp_neg
    
print(M)
for e in ans:
    print(e[0], e[1]) def all_pos(lst):
    for e in lst:
        if e < 0:
            return False
    return True all_pos for e in lst:
        if e < 0:
            return False
     e lst if e < 0:
            return False
     e < 0 e 0 return False False return True True lst lst def all_neg(lst):
    for e in lst:
        if e > 0:
            return False
    return True all_neg for e in lst:
        if e > 0:
            return False
     e lst if e > 0:
            return False
     e > 0 e 0 return False False return True True lst lst 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 ans = [] ans [] M = 0 M 0 if all_pos(A):
    A.sort()
    res = A[0]
    for i in range(1, N - 1):
        ans.append((res, A[i]))
        res -= A[i]
    ans.append((A[-1], res))
    M = A[-1] - res
elif all_neg(A):
    A.sort()
    A.reverse()
    res = A[0]
    for i in range(1, N):
        ans.append((res, A[i]))
        res -= A[i]
    M = res
else:
    A.sort()
    A.reverse()
    tmp_neg = A[-1]
    tmp_pos = A[0]
    for i in range(1, len(A) - 1):
        if A[i] >= 0:
            ans.append((tmp_neg, A[i]))
            tmp_neg -= A[i]
        else:
            ans.append((tmp_pos, A[i]))
            tmp_pos -= A[i]
    ans.append((tmp_pos, tmp_neg))
    M = tmp_pos - tmp_neg
     all_pos(A) all_pos A A.sort() A.sort A sort res = A[0] res A[0] A 0 for i in range(1, N - 1):
        ans.append((res, A[i]))
        res -= A[i]
     i range(1, N - 1) range 1 N - 1 N 1 ans.append((res, A[i])) ans.append ans append (res, A[i]) res A[i] A i res -= A[i] res A[i] A i ans.append((A[-1], res)) ans.append ans append (A[-1], res) A[-1] A -1 res M = A[-1] - res M A[-1] - res A[-1] A -1 res elif all_neg(A):
    A.sort()
    A.reverse()
    res = A[0]
    for i in range(1, N):
        ans.append((res, A[i]))
        res -= A[i]
    M = res all_neg(A) all_neg A A.sort() A.sort A sort A.reverse() A.reverse A reverse res = A[0] res A[0] A 0 for i in range(1, N):
        ans.append((res, A[i]))
        res -= A[i]
     i range(1, N) range 1 N ans.append((res, A[i])) ans.append ans append (res, A[i]) res A[i] A i res -= A[i] res A[i] A i M = res M res A.sort() A.sort A sort A.reverse() A.reverse A reverse tmp_neg = A[-1] tmp_neg A[-1] A -1 tmp_pos = A[0] tmp_pos A[0] A 0 for i in range(1, len(A) - 1):
        if A[i] >= 0:
            ans.append((tmp_neg, A[i]))
            tmp_neg -= A[i]
        else:
            ans.append((tmp_pos, A[i]))
            tmp_pos -= A[i]
     i range(1, len(A) - 1) range 1 len(A) - 1 len(A) len A 1 if A[i] >= 0:
            ans.append((tmp_neg, A[i]))
            tmp_neg -= A[i]
        else:
            ans.append((tmp_pos, A[i]))
            tmp_pos -= A[i]
     A[i] >= 0 A[i] A i 0 ans.append((tmp_neg, A[i])) ans.append ans append (tmp_neg, A[i]) tmp_neg A[i] A i tmp_neg -= A[i] tmp_neg A[i] A i ans.append((tmp_pos, A[i])) ans.append ans append (tmp_pos, A[i]) tmp_pos A[i] A i tmp_pos -= A[i] tmp_pos A[i] A i ans.append((tmp_pos, tmp_neg)) ans.append ans append (tmp_pos, tmp_neg) tmp_pos tmp_neg M = tmp_pos - tmp_neg M tmp_pos - tmp_neg tmp_pos tmp_neg print(M) print M for e in ans:
    print(e[0], e[1]) e ans print(e[0], e[1]) print e[0] e 0 e[1] e 1 res = A[0] A[0] res res -= A[i] A[i] res A = list(map(int, input().split())) list(map(int, input().split())) A N = int(input()) int(input()) N M = 0 0 M M = res res M def all_neg(lst):
    for e in lst:
        if e > 0:
            return False
    return True def all_neg(lst):
    for e in lst:
        if e > 0:
            return False
    return True all_neg M = A[-1] - res A[-1] - res M res -= A[i] A[i] res tmp_neg -= A[i] A[i] tmp_neg def all_pos(lst):
    for e in lst:
        if e < 0:
            return False
    return True def all_pos(lst):
    for e in lst:
        if e < 0:
            return False
    return True all_pos M = tmp_pos - tmp_neg tmp_pos - tmp_neg M tmp_neg = A[-1] A[-1] tmp_neg tmp_pos = A[0] A[0] tmp_pos res = A[0] A[0] res ans = [] [] ans tmp_pos -= A[i] A[i] tmp_pos
def all_pos(lst):
    for e in lst:
        if e < 0:
            return False
    return True

def all_neg(lst):
    for e in lst:
        if e > 0:
            return False
    return True

N = int(input())
A = list(map(int, input().split()))

ans = []
M = 0
if all_pos(A):
    A.sort()
    res = A[0]
    for i in range(1, N - 1):
        ans.append((res, A[i]))
        res -= A[i]
    ans.append((A[-1], res))
    M = A[-1] - res
elif all_neg(A):
    A.sort()
    A.reverse()
    res = A[0]
    for i in range(1, N):
        ans.append((res, A[i]))
        res -= A[i]
    M = res
else:
    A.sort()
    A.reverse()
    tmp_neg = A[-1]
    tmp_pos = A[0]
    for i in range(1, len(A) - 1):
        if A[i] >= 0:
            ans.append((tmp_neg, A[i]))
            tmp_neg -= A[i]
        else:
            ans.append((tmp_pos, A[i]))
            tmp_pos -= A[i]
    ans.append((tmp_pos, tmp_neg))
    M = tmp_pos - tmp_neg
    
print(M)
for e in ans:
    print(e[0], e[1])