import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.container;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

void calc(long[] a) {
    a.sort();

    auto ps = new DList!long;
    auto ns = new DList!long;
    int psize = 0;
    int nsize = 0;
    foreach (x; a) {
        if (x >= 0) {
            ps.insertBack(x);
            psize++;
        }
        else {
            ns.insertBack(x);
            nsize++;
        }
    }

    if (ps.empty) {
        ps.insertBack(ns.back);
        ns.removeBack();
        psize++;
        nsize--;
    }
    else if (ns.empty) {
        ns.insertBack(ps.front);
        ps.removeFront();
        psize--;
        nsize++;
    }

    long[][] steps;
    while (psize > 1 || nsize > 1) {
        if (psize > nsize) {
            long x = ns.back; ns.removeBack();
            long y = ps.back; ps.removeBack();
            ns.insertBack(x - y);
            psize--;
            steps ~= [x, y];
        }
        else {
            long x = ps.back; ps.removeBack();
            long y = ns.back; ns.removeBack();
            ps.insertBack(x - y);
            nsize--;
            steps ~= [x, y];
        }
    }

    long x = ps.back;
    long y = ns.back;
    steps ~= [x, y];
    long ans = x - y;
    writeln(ans);
    foreach (s; steps) {
        writeln(s[0], " ", s[1]);
    }
}

void main() {
    readint;
    auto a = reads!long;
    calc(a);
}
