#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

template<typename T1, typename T2>
inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }

template<typename T1, typename T2>
inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

//改造
typedef long long int ll;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0 //デバッグする時1にしてね
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//ここから編集する
class Solve {
public:
    int N;
    vector<ll> A;

    void input() {
        cin >> N;
        A.resize(N);
        rep(i, 0, N) cin >> A[i];
    }

    void kon() {
        vector<ll> plus;
        vector<ll> minus;
        int zero = 0;
        for (auto a : A) {
            if (a > 0) {
                plus.push_back(a);
            } else if (a < 0) {
                minus.push_back(a);
            } else {
                zero++;
            }
        }
        rep(i, 0, zero) {
            if (plus.size() < minus.size()) plus.push_back(0);
            else minus.push_back(0);
        }
        sort(all(plus));
        sort(all(minus));

        vector<ll> q1, q2;
        while (plus.size() > 1) {
            ll tmpm = minus.back();
            minus.pop_back();

            ll tmpp = plus.back();
            plus.pop_back();

            q1.push_back(tmpm);
            q2.push_back(tmpp);
//            cout << tmpm << " " << tmpp << endl;

            ll tmp = tmpm - tmpp;
            minus.push_back(tmp);
        }

        while (minus.size() > 0) {
            ll tmpp = plus.back();
            plus.pop_back();

            ll tmpm = minus.back();
            minus.pop_back();


//            cout << tmpp << " " << tmpm << endl;
            q1.push_back(tmpp);
            q2.push_back(tmpm);
            plus.push_back(tmpp - tmpm);
        }

        cout << plus[0] << endl;
        for (int i = 0; i < q1.size(); ++i) {
            cout << q1[i] << " " << q2[i] << endl;
        }

    }


    void ponly() {
        vector<ll> plus;
        vector<ll> minus;
        for (auto a : A) {
            if (a >= 0) {
                plus.push_back(a);
            } else {
                minus.push_back(a);
            }
        }
        sort(all(plus));
        sort(all(minus));

        ll nie = plus[0];
        plus.erase(plus.begin(), plus.begin() + 1);

        vector<ll> q1, q2;
        while (plus.size() > 1) {
            ll tmpp = plus.back();
            plus.pop_back();

            q1.push_back(nie);
            q2.push_back(tmpp);
//            cout << nie << " " << tmpp << endl;
            ll nnie = nie - tmpp;
            nie = nnie;
        }

//        cout << plus[0] << " " << nie << endl;
        q1.push_back(plus[0]);
        q2.push_back(nie);

        cout << plus[0] - nie << endl;
        for (int i = 0; i < q1.size(); ++i) {
            cout << q1[i] << " " << q2[i] << endl;
        }


    }

    void monly() {
        vector<ll> plus;
        vector<ll> minus;
        for (auto a : A) {
            if (a >= 0) {
                plus.push_back(a);
            } else {
                minus.push_back(a);
            }
        }
        sort(all(plus));
        sort(all(minus));
        reverse(all(plus));
        reverse(all(minus));

        ll nie = minus[0];
        minus.erase(minus.begin(), minus.begin() + 1);

        vector<ll> q1, q2;
        while (minus.size() > 0) {
            ll tmpm = minus.back();
            minus.pop_back();

            q1.push_back(nie);
            q2.push_back(tmpm);
//            cout << nie << " " << tmpm << endl;
            nie = nie - tmpm;
        }

        cout << nie << endl;
        for (int i = 0; i < q1.size(); ++i) {
            cout << q1[i] << " " << q2[i] << endl;
        }

    }


    void solve() {
        input();

        ll min_v = *min_element(all(A));
        ll max_v = *max_element(all(A));
        if (min_v > 0) {
            ponly();
        } else if (max_v < 0) {
            monly();
        } else {
            kon();
        }
    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    Solve().solve();


    return 0;
}


Measured memory_bytes: 6004