module ccc;import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;


void main() {
    auto N = readln.chomp.to!int;
    auto A = readln.split.map!(to!long).array;

    if (A.map!(a => a <= 0).all) {
        A.sort!"a > b";
        long ans = A.map!(a => abs(a)).sum + 2 * A.front;
        ans.writeln;
        long tmp = A.front;
        foreach (i; 1..N) {
            writeln(tmp, " ", A[i]);
            tmp -= A[i];
        }
    } else {
        A.sort();
        long ans = A.map!(a => abs(a)).sum;
        ans.writeln;
        auto plus = A.filter!(a => a >= 0).array;
        auto minus = A.filter!(a => a < 0).array;
        long tmp = minus.front;
        foreach (i; 0..plus.length.to!int-1) {
            writeln(tmp, " ", plus[i]);
            tmp -= plus[i];
        }
        writeln(plus.back, " ", tmp);
        tmp = plus.back - tmp;
        foreach (i; 1..minus.length) {
            writeln(tmp, " ", minus[i]);
            tmp -= minus[i];
        }
    }
}
