#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<unordered_set>
#include<unordered_map>
using namespace std;
typedef long long ll;
#define mod 1000000007
#define mad(a,b) a=(a+b)%mod;
#define N 100010
typedef pair<ll,ll> P;
vector<P> v;
ll n,a[N];
int main(){
  cin>>n;
  for(int i=0;i<n;i++)cin>>a[i];
  sort(a,a+n);
  for(int i=1;i<n-1;i++){
      if(a[i]<0)continue;
      v.push_back(make_pair(a[0],a[i]));
      a[0]=a[0]-a[i];
  }
  for(int i=1;i<n-1;i++){
      if(a[i]>=0)continue;
      v.push_back(make_pair(a[n-1],a[i]));
      a[n-1]=a[n-1]-a[i];
  }
  v.push_back(make_pair(a[n-1],a[0]));
  cout<<a[n-1]-a[0]<<endl;
  for(int i=0;i<n-1;i++){
      cout<<v[i].first<<" "<<v[i].second<<endl;
  }
  return 0;
}
