#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;



void solve(long long N, std::vector<long long> A){
    bool flag = false;
    ll sum = 0;
    vector<ll> abs_A;
    ll minus = 100000;
    sort(A.begin(), A.end());
    rep(i,N) {
        if (A[i] < 0) {
            flag = true; minus = i;
        }
        sum += abs(A[i]);
        abs_A.push_back(abs(A[i]));
    }
    sort(abs_A.begin(), abs_A.end());
    if (flag) {
        if (A[N-1] < 0) {
            cout << sum - abs(A[N-1]) * 2 << endl;
        }
        else
        {
            /* code */
            cout << sum << endl;
        }
        
    }
    else
    {
        cout << sum - abs_A[0] * 2 << endl;
    }

    // cout << "tejun" << endl;
    // cout << minus << endl;

    ll tmpx = 100000;
    if (minus==100000) {
        // cout << "now01" << endl;
        rep(i,N-1) {
            if (i==0) {
                cout << A[i] << " " << A[i+1] << endl;
                tmpx = A[i] - A[i+1];
            }
            else if (i==N-2) {
                cout << A[i+1] << " " << tmpx;
            }
            else
            {
                cout << tmpx << " " << A[i+1] << endl;
                tmpx -= A[i+1];
            }
        }
    }
    else
    {
        // cout << "now02" << endl;
        if (minus+1 == N) {
            for(int i=N-1;i>0;i--) {
                if (i==N-1) {
                    cout << A[i] << " " << A[i-1] << endl;
                    tmpx = A[i] - A[i-1];
                }
                else
                {
                    cout << tmpx << " " << A[i-1] << endl;
                    tmpx -= A[i-1];
                }
            }
        }
        else
        {
            for (int i=minus+1; i<N-1;i++) {
                if (i==minus+1) {
                    cout << A[i-1] << " " << A[i] << endl;
                    tmpx = A[i-1] - A[i];
                }
                else
                {
                    cout << tmpx << " " << A[i] << endl;
                    tmpx -= A[i];
                }
                // cout << "tmpx: " << tmpx << endl;
            } 
            for (int i=minus; i>=0;i--) {
                if (tmpx==100000 && i==minus) {
                    cout << A[N-1] << " " << A[i] << endl;
                    tmpx = A[N-1] - A[i];
                }
                else if (i==minus) {
                    cout << A[N-1] << " " << tmpx << endl;
                    tmpx = A[N-1] - tmpx;
                }
                else
                {
                    cout << tmpx << " " << A[i] << endl;
                    tmpx -= A[i];
                }
            }
            /* code */
        }
        
        /* code */
    }
    
    // rep(i,N-1) {
    //     if (i != N-2) {
    //         if (tmpx==100000) {
    //             cout << A[i] << " " << A[i+1] << endl;
    //             tmpx = A[i] - A[i+1];
    //         }
    //         else
    //         {
    //             cout << tmpx << " " << A[i+1] << endl;
    //             tmpx = tmpx - A[i+1];
    //         }
    //     }
    //     else
    //     {
    //         cout << A[i+1] << " " << tmpx << endl;
    //     }
        
    // }

    
    


}

// Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    solve(N, std::move(A));
    // return 0;
}


Measured memory_bytes: 3572