#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<deque>
#include<regex>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>

#define rep(i, n) for(int i=0;i<n;i++)

typedef int long long ll;
using namespace std;
typedef pair<int, int> P;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const ll MOD = 1e9 + 7;
static const int MAX = 100;
static const int INF = (1 << 23);



int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    vector<ll> m;
    vector<ll> s;
    bool f = true;
    bool t = true;
    bool zero=true;


    rep(i, n) {
        cin >> v[i];
        if (v[i] > 0)f = false;
        if (v[i] < 0)t = false;
        if(v[i]!=0)zero=false;
        if (v[i] >= 0)s.push_back(v[i]);
        if (v[i] < 0)m.push_back(v[i]);
    }
    //vector<ll> c;
    //sort(c.begin(),c.end());
    sort(v.begin(), v.end());
    sort(s.begin(), s.end());
    sort(m.begin(), m.end());
    vector<pair<ll, ll>> ans;
    if(zero){
        cout<<0<<endl;
        rep(i,n-1){
            cout<<0<<" "<<0<<endl;
        }
        return 0;
    }


    if(n==2){
        cout<<v[1]-v[0]<<endl;
        cout<<v[1]<<" "<<v[0]<<endl;
        return 0;
    }


    if (f) {//負のみ
        ll mi=v[0];
        ll ma=v[n-1];
        int p;
        int pl=0;int ne=0;
        rep(i,n){
            if(v[i]<0){
                p=i;
                ne++;
            }else{
                pl++;
            }
        }

        p++;

        if((n-ne-pl)==n){
            cout<<0<<endl;
            rep(i,n-1){
                cout<<0<<" "<<0<<endl;
            }
            return 0;
        }

        if(n==2){
            cout<<v[1]-v[0]<<endl;
            cout<<v[1]<<" "<<v[0]<<endl;
            return 0;
        }
        p=min(n-1,p);
        for(int i=1;i<p;i++){
            ans.push_back({ma,v[i]});
            ma-=v[i];
        }
        for(int i=p;i<n-1;i++){
            ans.push_back({mi,v[i]});
            mi-=v[i];
        }
        ans.push_back({ma,mi});
        cout<<ma-mi<<endl;

        rep(i,ans.size()){
            cout<<ans[i].first<<" "<<ans[i].second<<endl;
        }



        //cout<<s[100000000000]<<endl;


//        ll las = m[m.size() - 1];
//        // cout<<las<<endl;
//        for (int i = 1; i < m.size()-1 ; i++) {
//            ans.push_back({las, m[i]});
//            las -= m[i];
//        }
//
//        ans.push_back({las,m[0]});
//        las-=m[0];
//        cout << las << endl;
//
//
//        rep(i, ans.size()) {
//            cout << ans[i].first << " " << ans[i].second << endl;
//        }



    }else if(t){//正のみ

        ll lass=s[0];
        for(int i=2;i<s.size();i++){
            ans.push_back({lass,s[i]});
            lass-=s[i];
        }
        // cout<<lass<<endl;


        ans.push_back({s[1],lass});
        cout<<s[1]-lass<<endl;
        rep(i,ans.size()){
            cout<<ans[i].first<<" "<<ans[i].second<<endl;
        }

    }else{


        ll mi=v[0];
        ll ma=v[n-1];
        int p;
        int pl=0;int ne=0;
        rep(i,n){
            if(v[i]<0){
                p=i;
                ne++;
            }else{
                pl++;
            }
        }

        p++;

        if((n-ne-pl)==n){
            cout<<0<<endl;
            rep(i,n-1){
                cout<<0<<" "<<0<<endl;
            }
            return 0;
        }

        if(n==2){
            cout<<v[1]-v[0]<<endl;
            cout<<v[1]<<" "<<v[0]<<endl;
            return 0;
        }
        p=min(n-1,p);
        for(int i=1;i<p;i++){
            ans.push_back({ma,v[i]});
            ma-=v[i];
        }
        for(int i=p;i<n-1;i++){
            ans.push_back({mi,v[i]});
            mi-=v[i];
        }
        ans.push_back({ma,mi});
        cout<<ma-mi<<endl;

        rep(i,ans.size()){
            cout<<ans[i].first<<" "<<ans[i].second<<endl;
        }







    }
    return 0;
}


Measured memory_bytes: 5872