/*
// Author -> Preeyadarshee Dev
//
// train hard win easy :D
// nik is love
// nik is motivation
//
// do modulo operations very carefully
// try to avoid binary search, use linear search preferrably to make calculations easier
// always make your custom binary search and watch out for overflows
*/
//
#include <bits/stdc++.h>
#define mp                    make_pair
#define pb                    push_back
#define ll                   long long
#define ss                       second
#define ff                        first
#define fr(i,a,b)   for(ll i=a;i<b;i++)
#define f(i,n)                fr(i,0,n)
#define rf(i,b,a) for(ll i=b-1;i>=a;i--)
#define r(i,n)                rf(i,n,0)
#define inf                   1000000007
#define eps                  0.000000000000001
#define endl                       '\n'
#define sz(a)                int((a).size())
#define all(c)               (c).begin(),(c).end()
#define tr(c,i)              for(typeof(c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)         ((c).find(x) != (c).end())
#define cpresent(c,x)        (find(all(c),x) != (c).end())
#define pi                   pair<int,int>
#define PI                   3.141592653589793238462643383279502884197169399375105820974944592307816406286
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> ii;
typedef vector< int > vi;
typedef vector< vi > vvi;
int dx[8]={1,-1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};
int gcd(int a,int b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
bool cmp(vector<pair<ll,ll>>v1,vector<pair<ll,ll>>v2)
{
    return (int)v1.size()>(int)v2.size();
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ifstream fin;
    //ofstream fout;
    //fin.open("input.txt");
    //fout.open("output.txt");
    //let's fuck dp
    int n;
    cin>>n;
    vector<int> v(n);
    f(i,n)
    {
        cin>>v[i];
    }
    sort(all(v));
    if(v[0]*v.back()<=0)
    {
        vector<pair<int,int>> ans;
        ans.pb({v.back(),v[0]});
        int val=v.back()-v[0];
        v.pop_back();
        int i=1;
        if(v.back()>0)
        {
            if(v[i]>0)
            {
                val=-val;
                pair<int,int> p1=ans.back();
                ans.pop_back();
                swap(p1.ff,p1.ss);
                ans.pb(p1);
                while(i<(int)v.size()-1)
                {
                    ans.pb({val,v[i]});
                    val=val-v[i];
                    i++;
                }
                ans.pb({v[i],val});
                val=v[i]-val;
                cout<<val<<endl;
                for(auto i:ans)
                {
                    cout<<i.ff<<" "<<i.ss<<endl;
                }

            }
            else
            {
                while(v[i+1]<=0)
                {
                    ans.pb({val,v[i]});
                    val=val-v[i];
                    i++;
                }
                ans.pb({v[i],val});
                val=v[i]-val;
                i++;
                while(i<(int)v.size()-1)
                {
                    ans.pb({val,v[i]});
                    val=val-v[i];
                    i++;
                }
                ans.pb({v[i],val});
                val=v[i]-val;
                cout<<val<<endl;
                for(auto i:ans)
                {
                    cout<<i.ff<<" "<<i.ss<<endl;
                }

            }
        }
        else
        {
            while(i<(int)v.size())
            {
                ans.pb({val,v[i]});
                val=val-v[i];
                i++;
            }
            cout<<val<<endl;
            for(auto i:ans)
            {
                cout<<i.ff<<" "<<i.ss<<endl;
            }
        }
    }
    else
    {
        int maxi=-(1<<30);
        vector<int> vt;
        for(int i=1;i<n;i++)
        {
            if(maxi<(v[i]-v[i-1])-(abs(v[i])+abs(v[i-1])))
            {
                maxi=v[i]-v[i-1]-(abs(v[i])+abs(v[i-1]));
                vt.clear();
                vt={v[i],v[i-1]};
            }
        }
        multiset<int> mt;
        for(auto i:v)
        {
            mt.insert(i);
        }
        mt.erase(mt.find(vt[0]));
        mt.erase(mt.find(vt[1]));
        if((int)mt.size()==0)
        {
            if(vt[0]<0)
            {
                cout<<vt[0]-vt[1]<<endl;
                cout<<vt[0]<<" "<<vt[1]<<endl;

            }
            else
            {
                cout<<vt[0]-vt[1]<<endl;
                cout<<vt[0]<<" "<<vt[1]<<endl;
            }
        }
        else
        {
            if(vt[0]<0)
            {
                int val=vt[0]-vt[1];
                vector<pair<int,int>> ans;
                ans.pb({vt[0],vt[1]});
                auto itr=mt.begin();
                while(itr!=mt.end())
                {
                    ans.pb({val,*itr});
                    val=val-(*itr);
                    itr++;
                }
                cout<<val<<endl;
                for(auto i:ans)
                {
                    cout<<i.ff<<" "<<i.ss<<endl;
                }
            }
            else
            {
                int val=vt[0]-vt[1];
                vector<pair<int,int>> ans;
                ans.pb({vt[0],vt[1]});
                while((int)mt.size()>1)
                {
                    auto itr=mt.begin();
                    ans.pb({val,*itr});
                    val=val-(*itr);
                    mt.erase(itr);
                }
                auto itr=mt.begin();
                ans.pb({*itr,val});
                val=*itr-val;
                cout<<val<<endl;
                for(auto i:ans)
                {
                    cout<<i.ff<<" "<<i.ss<<endl;
                }
            }
        }
    }
}



Measured memory_bytes: 7800