#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const int INF = 1 << 28;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int main() {
    int n;
    cin >> n;
    vi a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());
    vl left, right;
    // int orign = n;
    // int nonzero = -1;
    // for (int i = 0; i < n; ++i) {
    //     if (a[i] != 0) {
    //         nonzero = i;
    //         break;
    //     }
    // }
    // if (nonzero == -1) {
    //     cout << 0 << "\n";
    //     for (int i = 0; i < n - 1; ++i) {
    //         cout << 0 << " " << 0 << endl;
    //     }
    //     return 0;
    // }
    // vi b;
    // for (int i = 0; i < orign; ++i) {
    //     if (a[i] == 0) {
    //         left.push_back(a[nonzero]);
    //         right.push_back(0);
    //         n--;
    //     } else {
    //         b.push_back(a[i]);
    //     }
    // }
    // a = b;

    if (n == 2) {
        cout << a[1] - a[0] << endl;
        // for (int i = 0; i < left.size(); ++i) {
        //     cout << left[i] << " " << right[i] << "\n";
        // }
        cout << a[1] << " " << a[0] << endl;
        return 0;
    }
    if (a[0] == a[n - 1]) {
        if (n == 2) {
            cout << 0 << endl;
            cout << a[0] << " " << a[1] << endl;
            return 0;
        } else if (n == 3) {
            cout << abs(a[0]) << endl;
            cout << a[0] << " " << a[0] << endl;
            if (a[0] >= 0)
                cout << a[0] << " " << 0 << endl;
            else
                cout << 0 << " " << a[0] << endl;
            return 0;
        }
        vi b(n - 2, a[0]);
        b[0] = -a[0];
        left.push_back(a[0]);
        right.push_back(a[0]);
        left.push_back(0);
        right.push_back(a[0]);
        a = b;
        n -= 2;
    } else if (a[0] * a[n - 1] >= 0) {
        vi b(n - 1);
        if (a[0] * a[n - 1] == 0) {
            if (a[0] < 0) {
                b[0] = a[n - 1] - a[0];
                left.push_back(a[n - 1]);
                right.push_back(a[0]);
            } else if (a[n - 1] > 0) {
                b[0] = a[0] - a[n - 1];
                left.push_back(a[0]);
                right.push_back(a[n - 1]);
            }
        } else if (a[0] > 0) {
            b[0] = a[0] - a[n - 1];
            left.push_back(a[0]);
            right.push_back(a[n - 1]);
        } else if (a[0] < 0) {
            b[0] = a[n - 1] - a[0];
            left.push_back(a[n - 1]);
            right.push_back(a[0]);
        }
        for (int i = 1; i < n - 1; ++i) {
            b[i] = a[i];
        }
        n--;
        a = b;
    }

    int pos = -1; // 0no
    int neg = -1;
    for (int i = 0; i < n; ++i) {
        if (a[i] < 0) {
            neg = i;
            break;
        }
    }
    for (int i = 0; i < n; ++i) {
        if (a[i] >= 0) {
            pos = i;
            break;
        }
    }
    ll tpos = a[pos];
    ll tneg = a[neg];
    ll ret = 0;
    if (n == 1) {
        ret = a[0];
    } else {
        for (int i = 0; i < n; ++i) {
            if (i != pos && i != neg) {
                if (a[i] >= 0) {
                    left.push_back(tneg);
                    right.push_back(a[i]);
                    tneg = tneg - a[i];
                } else {
                    left.push_back(tpos);
                    right.push_back(a[i]);
                    tpos = tpos - a[i];
                }
            }
        }
        ret = tpos - tneg;
        left.push_back(tpos);
        right.push_back(tneg);
    }
    cout << ret << "\n";
    for (int i = 0; i < left.size(); ++i) {
        cout << left[i] << " " << right[i] << "\n";
    }
    return 0;
}

Measured memory_bytes: 4596