#include <bits/stdc++.h>
#define sz(v)   ((int)(v).size())
#define  all(v)    ((v).begin()),((v).end())
#define  allr(v)    ((v).rbegin()),((v).rend())
#define   pb         push_back
#define   mp         make_pair
#define   mt         make_tuple
//#define   Y            imag()
//#define   X            real()
#define    clr(v,d)      memset( v, d ,sizeof(v))
#define   angle(n)      atan2((n.imag()),(n.real()))
#define   vec(a,b)       ((b)-(a))
//#define   length(a)      hypot( (a.imag()),(a.real()) )
#define   normalize(a)      (a)/(length(a))
//#define    dp(a,b)          (((conj(a))*(b)).real())
//#define    cp(a,b)          (((conj(a))*(b)).imag())
#define    lengthsqrt(a)       dp(a,a)
#define    rotate0( a,ang)    ((a)*exp( point(0,ang) ))
#define    rotateA(about,p,ang)   (rotate0(vec(about,p),ang)+about)
#define    reflection0(m,v)         (conj((v)/(m))*(m))
#define     reflectionA(m,v,p0)     (conj( (vec(p0,v))/(vec(p0,m)) ) * (vec(p0,m)) ) + p0
//#define     same(p1,p2)               ( dp(  vec(p1,p2),vec(p1,p2)) < eps )
#define     PT                    complex<double>
#define outfile freopen("out.out", "w", stdout);
#define infile  freopen("in.in", "r", stdin);
#define PI acos(-1)
typedef  long long     ll ;
typedef  unsigned long long ull;
const double eps= (1e-9);
using namespace std;
int dcmp(long double a,long double b){   return fabsl(a-b)<=eps ? 0: (a>b)? 1:-1  ;}
int getBit(int num, int idx) {return ((num >> idx) & 1) == 1;}
int setBit1(int num, int idx) {return num | (1<<idx);}
ll setBit0(ll num, int idx) {return num & ~(1ll<<idx);}
ll flipBit(int num, int idx) {return num ^ (1<<idx);}
void FS(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}

int n;
ll a[100009];
vector< pair<ll,ll> > v2;
vector<int> v;
int main()
{
    cin>>n;
    int cnt_n=0,cnt_p=0;
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
        int no=a[i];
        v.pb(no);
        if(no>0)
            cnt_p++;
        if(no<0)
            cnt_n++;

    }
    if(cnt_n==0)
    {
        ll sum=0;
        sort(all(v));
        sum=v[0];
        for(int i=2;i<n;i++)
        {
            v2.pb(mp(sum,v[i]));
            sum-=v[i];
        }

        v2.pb(mp(v[1],sum));
        cout<<v[1]-sum<<endl;
       for(int i=0;i<sz(v2);i++)
            cout<<v2[i].first<<" "<<v2[i].second<<endl;
        return 0;
    }
    if(cnt_p==0)
    {
        sort(allr(v));
        ll sum=0;
        sum=v[0];
        for(int i=1;i<n;i++)
        {
            v2.pb(mp(sum,v[i]));
            sum-=v[i];
        }
        cout<<sum<<endl;
        for(int i=0;i<sz(v2);i++)
            cout<<v2[i].first<<" "<<v2[i].second<<endl;

        return 0;
    }
    // pos_id;
    int id1=0,id2=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]>=0)
        {
            id1=i;
            break;
        }
    }
    // neg_id;
    for(int i=0;i<n;i++)
    {
        if(a[i]<=0&&i!=id1)
        {
            id2=i;
            break;
        }
    }
    ll lf=a[id1];
    for(int i=0;i<n;i++)
    {
        if(a[i]<0&&i!=id2&&i!=id1)
        {
            v2.pb(mp(lf,a[i]));
            lf-=a[i];
        }
    }
    ll rg=a[id2];
    for(int i=0;i<n;i++)
    {
        if(a[i]>=0&&i!=id2&&i!=id1)
        {
            v2.pb(mp(rg,a[i]));
            rg-=a[i];
        }
    }
    v2.pb(mp(lf,rg));
    cout<<lf-rg<<endl;

    for(int i=0;i<sz(v2);i++)
        cout<<v2[i].first<<" "<<v2[i].second<<endl;
}



Measured memory_bytes: 4720