import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0; 
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int n = read.to!int;
	long[] as;
	foreach(i; 0 .. n) as ~= read.to!long;
	
	long[] ps, qs, zs;
	foreach(a; as) if(a > 0) ps ~= a; else if(a < 0) qs ~= a; else zs ~= a;
	
	long[] ls, rs;
	if(ps.length > 0 && qs.length > 0){
		ls = ps ~ zs, rs = qs;
	}
	else if(ps.length == 0){
		if(zs.length > 0) ls = zs, rs = qs;
		else{
			qs.sort();
			ls = [qs[$ - 1]], rs = qs[0 .. $ - 1];
		}
	}
	else if(qs.length == 0){
		if(zs.length > 0) ls = ps, rs = zs;
		else{
			ps.sort();
			ls = ps[1 .. $], rs = [ps[0]];
		}
	}
	
	long[2][] ans;
	long v = ls[0];
	if(rs.length > 1) foreach(r; rs[1 .. $]){
		ans ~= [v, r];
		v = v - r;
	}
	
	long w = rs[0];
	if(ls.length > 1) foreach(l; ls[1 .. $]){
		ans ~= [w, l];
		w = w - l;
	}
	
	ans ~= [v, w];
	v = v - w;
	
	v.writeln;
	foreach(an; ans) writeln(an[0], " ", an[1]);
	
}

