def c(N, A):
    A.sort()
    maximum = A.pop()
    minimum = A.pop(0)
    operation = []
    for a in A:
        if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
    operation.append('{} {}'.format(maximum, minimum))
    return str(maximum - minimum) + '\n' + '\n'.join(operation)

N = int(input())
A = list(map(int, input().split()))
print(c(N, A)) def c(N, A):
    A.sort()
    maximum = A.pop()
    minimum = A.pop(0)
    operation = []
    for a in A:
        if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
    operation.append('{} {}'.format(maximum, minimum))
    return str(maximum - minimum) + '\n' + '\n'.join(operation) c A.sort() A.sort A sort maximum = A.pop() maximum A.pop() A.pop A pop minimum = A.pop(0) minimum A.pop(0) A.pop A pop 0 operation = [] operation [] for a in A:
        if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
     a A if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
     a >= 0 a 0 operation.append('{} {}'.format(minimum, a)) operation.append operation append '{} {}'.format(minimum, a) '{} {}'.format '{} {}' format minimum a minimum -= a minimum a operation.append('{} {}'.format(maximum, a)) operation.append operation append '{} {}'.format(maximum, a) '{} {}'.format '{} {}' format maximum a maximum -= a maximum a operation.append('{} {}'.format(maximum, minimum)) operation.append operation append '{} {}'.format(maximum, minimum) '{} {}'.format '{} {}' format maximum minimum return str(maximum - minimum) + '\n' + '\n'.join(operation) str(maximum - minimum) + '\n' + '\n'.join(operation) str(maximum - minimum) + '\n' str(maximum - minimum) str maximum - minimum maximum minimum '\n' '\n'.join(operation) '\n'.join '\n' join operation N N A A 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 print(c(N, A)) print c(N, A) c N A N = int(input()) int(input()) N A = list(map(int, input().split())) list(map(int, input().split())) A def c(N, A):
    A.sort()
    maximum = A.pop()
    minimum = A.pop(0)
    operation = []
    for a in A:
        if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
    operation.append('{} {}'.format(maximum, minimum))
    return str(maximum - minimum) + '\n' + '\n'.join(operation) def c(N, A):
    A.sort()
    maximum = A.pop()
    minimum = A.pop(0)
    operation = []
    for a in A:
        if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
    operation.append('{} {}'.format(maximum, minimum))
    return str(maximum - minimum) + '\n' + '\n'.join(operation) c
def c(N, A):
    A.sort()
    maximum = A.pop()
    minimum = A.pop(0)
    operation = []
    for a in A:
        if a >= 0:
            operation.append('{} {}'.format(minimum, a))
            minimum -= a
        else:
            operation.append('{} {}'.format(maximum, a))
            maximum -= a
    operation.append('{} {}'.format(maximum, minimum))
    return str(maximum - minimum) + '\n' + '\n'.join(operation)

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