#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

typedef tree<int, null_type, less<int>, rb_tree_tag,
        tree_order_statistics_node_update>
        new_data_set;


#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define PSET(x,y) fixed<<setprecision(y)<<x
#define pb push_back
#define pf push_front
#define mp make_pair
#define pii pair<int,int>
#define vi vector<int>
#define vip vector<pair<int,int> >
#define ff first
#define ss second
#define int long long
#define SIZE 200010
#define mod 1000000007
#define BIG 998244353
#define s(t) scanf("%d",&t)
#define p(t) printf("%d\n",t)
#define mii map<int,int>
#define MSET(table,i) memset(table, i, sizeof(table))
#define INF 1e18
#define endl '\n'
//#define tc int t;cin>>t;while(t--)
#define pi  3.1415926358
#define print(x) for(auto el: x) cout<<el<<" ";cout<<endl
#define bits(x) __builtin_popcount(x)
#define minimum(a,n) min_element(a,a+n)-a
#define maximum(a,n) max_element(a,a+n)-a
#define pqbig priority_queue<int>
#define pqsmall priority_queue<int,vector<int>,greater<int> >
#define all(v) v.begin(),v.end()
#define sitr set<int>:: iterator
#define mitr map<int,int>:: iterator


#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl

vi v1,v2;

void onlypos(int n,int *arr)
{
    if(n==2)
    {
        cout<<v1[1]<<" "<<v1[0];
        return;
    }
    while((int)v1.size()!=2)
    {
        int x=v1[(int)v1.size()-1];
        int y=v1[0];
        cout<<y<<" "<<x<<endl;
        v1[0]=y-x;
        v1.pop_back();
    }
    cout<<v1[v1.size()-1]<<" "<<v1[0]<<endl;
}

void onlyneg(int n,int *arr)
{
    if(n==2)
    {
        cout<<v2[1]<<" "<<v2[0];
        return;
    }
    cout<<v2[v2.size()-1]<<" "<<v2[0]<<endl;
    v2[0]=v2[v2.size()-1]-v2[0];
    int last=v2[0];
    for(int i=1;i<(v2.size()-1);i++)
        cout<<last<<" "<<v2[i]<<endl,last-=v2[i];
}

void both(int n,int *arr)
{
    int pos=v1[0];
    for(int i=0;i<((int)v2.size()-1);i++)
        cout<<pos<<" "<<v2[i]<<endl,pos-=v2[i];
    if(v1.size()==1)
        cout<<pos<<" "<<v2[(int)v2.size()-1]<<endl;
    else
    {
        cout<<v2[(int)v2.size()-1]<<" "<<pos<<endl;
        int neg_num=v2[(int)v2.size()-1]-pos;

        for(int i=1;i<((int)v1.size()-1);i++)
            cout<<neg_num<<" "<<v1[i]<<endl,neg_num-=v1[i];
        cout<<v1[(int)v1.size()-1]<<" "<<neg_num<<endl;
    }
}

int32_t main()
{
    fast;
    /*#ifndef ONLINE_JUDGE 
    freopen("input.txt", "r", stdin); 
    freopen("output.txt", "w", stdout); 
    #endif*/

    int n;cin>>n;
    int *arr=new int[n];
    bool pos=false,neg=false;
    int sum=0;
    for(int i=0;i<n;i++)
        cin>>arr[i];

    sort(arr,arr+n);
    for(int i=0;i<n;i++)
    {
        if(arr[i]==0)
        {
            if(!neg)
                neg=true,v2.pb(0);
            else
                pos=true,v1.pb(0);
        }
        else if(arr[i]>0)
            pos=true,v1.pb(arr[i]);
        else if(arr[i]<0)
            neg=true,v2.pb(arr[i]);
        sum+=abs(arr[i]);
    }
    if(pos and neg)
        cout<<sum<<endl;
    else if(pos)
        cout<<sum-2*arr[minimum(arr,n)]<<endl;
    else
        cout<<sum+2*arr[maximum(arr,n)]<<endl;

    if(pos and !neg)
        onlypos(n,arr);
    else if(neg and !pos)
        onlyneg(n,arr);
    else
        both(n,arr);
}

Measured memory_bytes: 3572