#include<bits/stdc++.h>
using namespace std;
#define N 100000
int a[N+1];
int main(){
	int n,sum=0,po=0,i;scanf("%d",&n);
	for(i=1;i<=n;i++)scanf("%d",a+i),sum+=abs(a[i]),po+=a[i]>0;
	sort(a+1,a+n+1);
	if(po==n){
		printf("%d\n",sum-2*a[1]);
		for(i=2;i<n;i++)printf("%d %d\n",a[1],a[i]),a[1]-=a[i];
		printf("%d %d\n",a[n],a[1]);
	}
	else if(!po){
		printf("%d\n",sum+2*a[n]);
		for(i=n-1;i;i--)printf("%d %d\n",a[n],a[i]),a[n]-=a[i];
	}
	else{
		printf("%d\n",sum);
		for(i=n-po+1;i<n;i++)printf("%d %d\n",a[1],a[i]),a[1]-=a[i];
		printf("%d %d\n",a[n],a[1]);a[n]-=a[1];
		for(i=2;i<=n-po;i++)printf("%d %d\n",a[n],a[i]),a[n]-=a[i];
	}
	return 0;
}
/*1
3
1 -1 2
*/
/*2
3
1 1 1
*/