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

A = sorted(A)

count_m = 0
count_z = 0
count_p = 0
sum_abs = 0

for i in range(N):
    if A[i] < 0:
        count_m += 1
        sum_abs -= A[i]
    elif A[i] == 0:
        count_z += 1
    else:
        count_p += 1
        sum_abs += A[i]

if count_m + count_z == 0:
    print(sum_abs-2*min(A))
    tmp = A[0]
    for i in range(N-2):
        print(tmp, A[i+1])
        tmp -= A[i+1]
    print(A[-1], tmp)

elif count_p + count_z == 0:
    print(sum_abs+2*max(A))
    tmp = A[-1]
    for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i]

elif count_p + count_m == 0:
    print(0)
    for i in range(N-1):
        print(0, 0)

else:
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    if count_p != 0:
        for i in range(count_p-1):
            print(tmp_2, A[i+cmz])
            tmp_2 -= A[i+cmz]
        print(tmp, tmp_2) 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 = sorted(A) A sorted(A) sorted A count_m = 0 count_m 0 count_z = 0 count_z 0 count_p = 0 count_p 0 sum_abs = 0 sum_abs 0 for i in range(N):
    if A[i] < 0:
        count_m += 1
        sum_abs -= A[i]
    elif A[i] == 0:
        count_z += 1
    else:
        count_p += 1
        sum_abs += A[i] i range(N) range N if A[i] < 0:
        count_m += 1
        sum_abs -= A[i]
    elif A[i] == 0:
        count_z += 1
    else:
        count_p += 1
        sum_abs += A[i] A[i] < 0 A[i] A i 0 count_m += 1 count_m 1 sum_abs -= A[i] sum_abs A[i] A i elif A[i] == 0:
        count_z += 1
     A[i] == 0 A[i] A i 0 count_z += 1 count_z 1 count_p += 1 count_p 1 sum_abs += A[i] sum_abs A[i] A i if count_m + count_z == 0:
    print(sum_abs-2*min(A))
    tmp = A[0]
    for i in range(N-2):
        print(tmp, A[i+1])
        tmp -= A[i+1]
    print(A[-1], tmp)

elif count_p + count_z == 0:
    print(sum_abs+2*max(A))
    tmp = A[-1]
    for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i]

elif count_p + count_m == 0:
    print(0)
    for i in range(N-1):
        print(0, 0)

else:
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    if count_p != 0:
        for i in range(count_p-1):
            print(tmp_2, A[i+cmz])
            tmp_2 -= A[i+cmz]
        print(tmp, tmp_2) count_m + count_z == 0 count_m + count_z count_m count_z 0 print(sum_abs-2*min(A)) print sum_abs-2*min(A) sum_abs 2*min(A) 2 min(A) min A tmp = A[0] tmp A[0] A 0 for i in range(N-2):
        print(tmp, A[i+1])
        tmp -= A[i+1]
     i range(N-2) range N-2 N 2 print(tmp, A[i+1]) print tmp A[i+1] A i+1 i 1 tmp -= A[i+1] tmp A[i+1] A i+1 i 1 print(A[-1], tmp) print A[-1] A -1 tmp elif count_p + count_z == 0:
    print(sum_abs+2*max(A))
    tmp = A[-1]
    for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i] count_p + count_z == 0 count_p + count_z count_p count_z 0 print(sum_abs+2*max(A)) print sum_abs+2*max(A) sum_abs 2*max(A) 2 max(A) max A tmp = A[-1] tmp A[-1] A -1 for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i] i range(N-1) range N-1 N 1 print(tmp, A[i]) print tmp A[i] A i tmp -= A[i] tmp A[i] A i elif count_p + count_m == 0:
    print(0)
    for i in range(N-1):
        print(0, 0) count_p + count_m == 0 count_p + count_m count_p count_m 0 print(0) print 0 for i in range(N-1):
        print(0, 0) i range(N-1) range N-1 N 1 print(0, 0) print 0 0 print(sum_abs) print sum_abs cmz = count_m + count_z cmz count_m + count_z count_m count_z tmp = A[-1] tmp A[-1] A -1 for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
     i range(cmz - 1) range cmz - 1 cmz 1 print(tmp, A[i]) print tmp A[i] A i tmp -= A[i] tmp A[i] A i tmp_2 = A[cmz-1] tmp_2 A[cmz-1] A cmz-1 cmz 1 if count_p != 0:
        for i in range(count_p-1):
            print(tmp_2, A[i+cmz])
            tmp_2 -= A[i+cmz]
        print(tmp, tmp_2) count_p != 0 count_p 0 for i in range(count_p-1):
            print(tmp_2, A[i+cmz])
            tmp_2 -= A[i+cmz]
         i range(count_p-1) range count_p-1 count_p 1 print(tmp_2, A[i+cmz]) print tmp_2 A[i+cmz] A i+cmz i cmz tmp_2 -= A[i+cmz] tmp_2 A[i+cmz] A i+cmz i cmz print(tmp, tmp_2) print tmp tmp_2 count_p = 0 0 count_p tmp -= A[i+1] A[i+1] tmp A = sorted(A) sorted(A) A count_z += 1 1 count_z count_m = 0 0 count_m sum_abs -= A[i] A[i] sum_abs tmp_2 = A[cmz-1] A[cmz-1] tmp_2 count_z = 0 0 count_z tmp -= A[i] A[i] tmp tmp = A[-1] A[-1] tmp A = list(map(int, input().split())) list(map(int, input().split())) A count_m += 1 1 count_m count_p += 1 1 count_p tmp = A[-1] A[-1] tmp N = int(input()) int(input()) N cmz = count_m + count_z count_m + count_z cmz tmp -= A[i] A[i] tmp tmp_2 -= A[i+cmz] A[i+cmz] tmp_2 sum_abs = 0 0 sum_abs sum_abs += A[i] A[i] sum_abs tmp = A[0] A[0] tmp
N = int(input())
A = list(map(int, input().split()))

A = sorted(A)

count_m = 0
count_z = 0
count_p = 0
sum_abs = 0

for i in range(N):
    if A[i] < 0:
        count_m += 1
        sum_abs -= A[i]
    elif A[i] == 0:
        count_z += 1
    else:
        count_p += 1
        sum_abs += A[i]

if count_m + count_z == 0:
    print(sum_abs-2*min(A))
    tmp = A[0]
    for i in range(N-2):
        print(tmp, A[i+1])
        tmp -= A[i+1]
    print(A[-1], tmp)

elif count_p + count_z == 0:
    print(sum_abs+2*max(A))
    tmp = A[-1]
    for i in range(N-1):
        print(tmp, A[i])
        tmp -= A[i]

elif count_p + count_m == 0:
    print(0)
    for i in range(N-1):
        print(0, 0)

else:
    print(sum_abs)
    cmz = count_m + count_z
    tmp = A[-1]
    for i in range(cmz - 1):
        print(tmp, A[i])
        tmp -= A[i]
    tmp_2 = A[cmz-1]
    if count_p != 0:
        for i in range(count_p-1):
            print(tmp_2, A[i+cmz])
            tmp_2 -= A[i+cmz]
        print(tmp, tmp_2)