#include<bits/stdc++.h>
using namespace std;
#define INF (1LL<<60)
#define DEKAI 1000000007
#define lp(i,n) for(int i=0;i<n;i++)
#define int long long

#define N 100


signed main(){
	int n;
	cin>>n;
	vector<int> v;
	int sum=0;
	lp(i,n){
		int a;
		cin>>a;
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	vector<pair<int,int>> ans;
	int maxi=v[n-1];
	int mini=v[0];
	for(int i=1;i<n-1;i++){
		if(v[i]<0){
			ans.push_back({maxi,v[i]});
			maxi-=v[i];
			continue;
		}
		ans.push_back({mini,v[i]});
		mini-=v[i];
	}
	cout<<maxi-mini<<endl;
	lp(i,ans.size()){
		cout<<ans[i].first<<" "<<ans[i].second<<endl;
	}
	cout<<maxi<<" "<<mini<<endl;
  	return 0;
}