n = int(input())
A = list(map(int, input().split()))
A.sort()
amin = A[0]
amax = A[-1]
B = A[1:-1]
action = []
for b in B:
    if b < 0:
        action.append((amax, b))
        amax -= b
    else:
        action.append((amin, b))
        amin -= b
action.append((amax, amin))
score = amax - amin
print(score)
for x, y in action:
    print('{} {}'.format(x, y)) 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 amin = A[0] amin A[0] A 0 amax = A[-1] amax A[-1] A -1 B = A[1:-1] B A[1:-1] A 1:-1 1 -1 action = [] action [] for b in B:
    if b < 0:
        action.append((amax, b))
        amax -= b
    else:
        action.append((amin, b))
        amin -= b b B if b < 0:
        action.append((amax, b))
        amax -= b
    else:
        action.append((amin, b))
        amin -= b b < 0 b 0 action.append((amax, b)) action.append action append (amax, b) amax b amax -= b amax b action.append((amin, b)) action.append action append (amin, b) amin b amin -= b amin b action.append((amax, amin)) action.append action append (amax, amin) amax amin score = amax - amin score amax - amin amax amin print(score) print score for x, y in action:
    print('{} {}'.format(x, y)) x y action print('{} {}'.format(x, y)) print '{} {}'.format(x, y) '{} {}'.format '{} {}' format x y amax = A[-1] A[-1] amax amax -= b b amax score = amax - amin amax - amin score A = list(map(int, input().split())) list(map(int, input().split())) A B = A[1:-1] A[1:-1] B amin = A[0] A[0] amin n = int(input()) int(input()) n action = [] [] action amin -= b b amin
n = int(input())
A = list(map(int, input().split()))
A.sort()
amin = A[0]
amax = A[-1]
B = A[1:-1]
action = []
for b in B:
    if b < 0:
        action.append((amax, b))
        amax -= b
    else:
        action.append((amin, b))
        amin -= b
action.append((amax, amin))
score = amax - amin
print(score)
for x, y in action:
    print('{} {}'.format(x, y))