#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }

typedef long long  ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
int a[100010];
int n;
int main()
{

    cin >> n;
    REP(i, n)
        cin >> a[i];
    sort(a, a + n);
    ll cnt = 0;
    for (int i = 0; i < n; i++)
    {
        cnt += a[i];
    }
    int line = 0;
    bool flag = false;
    for (int i = 0; i < n; i++)
    {
        if(a[i]>=0){
            flag = true;
            line = i;
            break;
        }
    }
    //a<0
    if(!flag){
        ll s = 0;
        s = a[n-1];
        ll sum =a[n-1];
        for (int i = n-2; i >=0; i--)
        {
            sum -= a[i];
        }
        cout << sum << endl;
        for (int i = n-2; i >=0; i--)
        {
            cout << s <<" "<< a[i]<<endl;
            s -= a[i];
        }
    }
    else if(line==0){
        ll sum = a[0];
        for (int i = 1; i < n-1 ; i++)
        {
            sum -= a[i];
        }
        sum=a[n - 1] - sum;
        cout << sum << endl;
        ll s = a[0];
        for (int i = 1; i < n - 1; i++)
        {
            cout << s <<" "<< a[i] << endl;
            s -= a[i];
        }
        cout << a[n - 1] << " " << s << endl;
    }
    else{
        ll sum = 0;
        for (int i = 0; i < n; i++)
        {
            sum += abs(a[i]);
        }
        cout << sum << endl;
        ll s = a[0];

        for (int i =n-2; i>=line; i--)
        {
            cout << a[0] << " "<<a[i]<< endl;
            a[0] -= a[i];

        }
        //cout << a[n - 1] << s << endl;
        for (size_t i = 0; i <=line-1; i++)
        {
            cout << a[n - 1] << " " << a[i] << endl;
            a[n - 1] -= a[i];
        }
    }

    return 0;
}

Measured memory_bytes: 2304