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

# 正-負をなるべく多く達成するように操作する
P = sorted((a for a in A if a >= 0), reverse=True)
Q = sorted(a for a in A if a < 0)

x, y = [], []
if len(P) == 2 and not Q:
    Y, X = P.pop(), P.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y)
if len(P) >= 3 and not Q:
    X, Y = P.pop(), P.pop()
    x.append(X)
    y.append(Y)
    Q.append(X - Y)
if not P and len(Q) >= 2:
    X, Y = Q.pop(), Q.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y)
while len(P) >= 2 and Q:
    X, Y = Q.pop(), P.pop()
    x.append(X)
    y.append(Y)
    Q.append(X - Y)
while Q:
    X, Y = P.pop(), Q.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y)

ans = (
    '{}\n{}'.format(
        P[0],
        '\n'.join(
            '{} {}'.format(X, Y)
            for X, Y in zip(x, y)
        )
    )
)

# 出力
print(ans) 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 for a in A if a >= 0 for a in A if a >= 0 a A a >= 0 a 0 if a >= 0 a P = sorted((a for a in A if a >= 0), reverse=True) P sorted((a for a in A if a >= 0), reverse=True) sorted (a for a in A if a >= 0) reverse=True reverse True Q = sorted(a for a in A if a < 0) Q sorted(a for a in A if a < 0) sorted a x, y = [], [] x [] y [] if len(P) == 2 and not Q:
    Y, X = P.pop(), P.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y) len(P) == 2 and not Q len(P) == 2 len(P) len P 2 not Q Q Y, X = P.pop(), P.pop() Y P.pop() P.pop P pop X P.pop() P.pop P pop x.append(X) x.append x append X y.append(Y) y.append y append Y P.append(X - Y) P.append P append X - Y X Y if len(P) >= 3 and not Q:
    X, Y = P.pop(), P.pop()
    x.append(X)
    y.append(Y)
    Q.append(X - Y) len(P) >= 3 and not Q len(P) >= 3 len(P) len P 3 not Q Q X, Y = P.pop(), P.pop() X P.pop() P.pop P pop Y P.pop() P.pop P pop x.append(X) x.append x append X y.append(Y) y.append y append Y Q.append(X - Y) Q.append Q append X - Y X Y if not P and len(Q) >= 2:
    X, Y = Q.pop(), Q.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y) not P and len(Q) >= 2 not P P len(Q) >= 2 len(Q) len Q 2 X, Y = Q.pop(), Q.pop() X Q.pop() Q.pop Q pop Y Q.pop() Q.pop Q pop x.append(X) x.append x append X y.append(Y) y.append y append Y P.append(X - Y) P.append P append X - Y X Y while len(P) >= 2 and Q:
    X, Y = Q.pop(), P.pop()
    x.append(X)
    y.append(Y)
    Q.append(X - Y) len(P) >= 2 and Q len(P) >= 2 len(P) len P 2 Q X, Y = Q.pop(), P.pop() X Q.pop() Q.pop Q pop Y P.pop() P.pop P pop x.append(X) x.append x append X y.append(Y) y.append y append Y Q.append(X - Y) Q.append Q append X - Y X Y while Q:
    X, Y = P.pop(), Q.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y) Q X, Y = P.pop(), Q.pop() X P.pop() P.pop P pop Y Q.pop() Q.pop Q pop x.append(X) x.append x append X y.append(Y) y.append y append Y P.append(X - Y) P.append P append X - Y X Y ans = (
    '{}\n{}'.format(
        P[0],
        '\n'.join(
            '{} {}'.format(X, Y)
            for X, Y in zip(x, y)
        )
    )
) ans '{}\n{}'.format(
        P[0],
        '\n'.join(
            '{} {}'.format(X, Y)
            for X, Y in zip(x, y)
        )
    ) '{}\n{}'.format '{}\n{}' format P[0] P 0 '\n'.join(
            '{} {}'.format(X, Y)
            for X, Y in zip(x, y)
        ) '\n'.join '\n' join '{} {}'.format(X, Y) '{} {}'.format '{} {}' format X Y print(ans) print ans y = [], [] [] y X, Y = P.pop(), Q.pop() P.pop() X Y = Q.pop(), Q.pop() Q.pop() Y Y = P.pop(), Q.pop() Q.pop() Y A = list(map(int, input().split())) list(map(int, input().split())) A X, Y = Q.pop(), Q.pop() Q.pop() X Y = P.pop(), P.pop() P.pop() Y Q = sorted(a for a in A if a < 0) sorted(a for a in A if a < 0) Q Y, X = P.pop(), P.pop() P.pop() Y X, Y = P.pop(), P.pop() P.pop() X ans = (
    '{}\n{}'.format(
        P[0],
        '\n'.join(
            '{} {}'.format(X, Y)
            for X, Y in zip(x, y)
        )
    )
) '{}\n{}'.format(
        P[0],
        '\n'.join(
            '{} {}'.format(X, Y)
            for X, Y in zip(x, y)
        )
    ) ans N = int(input()) int(input()) N X = P.pop(), P.pop() P.pop() X x, y = [], [] [] x X, Y = Q.pop(), P.pop() Q.pop() X P = sorted((a for a in A if a >= 0), reverse=True) sorted((a for a in A if a >= 0), reverse=True) P Y = Q.pop(), P.pop() P.pop() Y
# 入力
N = int(input())
A = list(map(int, input().split()))

# 正-負をなるべく多く達成するように操作する
P = sorted((a for a in A if a >= 0), reverse=True)
Q = sorted(a for a in A if a < 0)

x, y = [], []
if len(P) == 2 and not Q:
    Y, X = P.pop(), P.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y)
if len(P) >= 3 and not Q:
    X, Y = P.pop(), P.pop()
    x.append(X)
    y.append(Y)
    Q.append(X - Y)
if not P and len(Q) >= 2:
    X, Y = Q.pop(), Q.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y)
while len(P) >= 2 and Q:
    X, Y = Q.pop(), P.pop()
    x.append(X)
    y.append(Y)
    Q.append(X - Y)
while Q:
    X, Y = P.pop(), Q.pop()
    x.append(X)
    y.append(Y)
    P.append(X - Y)

ans = (
    '{}\n{}'.format(
        P[0],
        '\n'.join(
            '{} {}'.format(X, Y)
            for X, Y in zip(x, y)
        )
    )
)

# 出力
print(ans)
