import bisect

def main():
	n = int(input())
	a = list(map(int,input().split()))
	a.sort()
	idx = bisect.bisect_left(a,0)
	if idx == 0:
		idx = 1
	elif idx == n:
		idx = -1
	cur_min = a[0]
	cur_max = a[-1]
	res = []
	for n in a[1:idx]:
		res.append('{} {}'.format(cur_max,n))
		cur_max -= n
	for n in a[idx:-1]:
		res.append('{} {}'.format(cur_min,n))
		cur_min -= n
	res.append('{} {}'.format(cur_max,cur_min))
	print(cur_max-cur_min)
	for r in res:
		print(r)

if __name__ == '__main__':
	main() import bisect bisect def main():
	n = int(input())
	a = list(map(int,input().split()))
	a.sort()
	idx = bisect.bisect_left(a,0)
	if idx == 0:
		idx = 1
	elif idx == n:
		idx = -1
	cur_min = a[0]
	cur_max = a[-1]
	res = []
	for n in a[1:idx]:
		res.append('{} {}'.format(cur_max,n))
		cur_max -= n
	for n in a[idx:-1]:
		res.append('{} {}'.format(cur_min,n))
		cur_min -= n
	res.append('{} {}'.format(cur_max,cur_min))
	print(cur_max-cur_min)
	for r in res:
		print(r) main n = int(input()) n int(input()) int input() input a = list(map(int,input().split())) a list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split a.sort() a.sort a sort idx = bisect.bisect_left(a,0) idx bisect.bisect_left(a,0) bisect.bisect_left bisect bisect_left a 0 if idx == 0:
		idx = 1
	elif idx == n:
		idx = -1
	 idx == 0 idx 0 idx = 1 idx 1 elif idx == n:
		idx = -1
	 idx == n idx n idx = -1 idx -1 cur_min = a[0] cur_min a[0] a 0 cur_max = a[-1] cur_max a[-1] a -1 res = [] res [] for n in a[1:idx]:
		res.append('{} {}'.format(cur_max,n))
		cur_max -= n
	 n a[1:idx] a 1:idx 1 idx res.append('{} {}'.format(cur_max,n)) res.append res append '{} {}'.format(cur_max,n) '{} {}'.format '{} {}' format cur_max n cur_max -= n cur_max n for n in a[idx:-1]:
		res.append('{} {}'.format(cur_min,n))
		cur_min -= n
	 n a[idx:-1] a idx:-1 idx -1 res.append('{} {}'.format(cur_min,n)) res.append res append '{} {}'.format(cur_min,n) '{} {}'.format '{} {}' format cur_min n cur_min -= n cur_min n res.append('{} {}'.format(cur_max,cur_min)) res.append res append '{} {}'.format(cur_max,cur_min) '{} {}'.format '{} {}' format cur_max cur_min print(cur_max-cur_min) print cur_max-cur_min cur_max cur_min for r in res:
		print(r) r res print(r) print r if __name__ == '__main__':
	main() __name__ == '__main__' __name__ '__main__' main() main def main():
	n = int(input())
	a = list(map(int,input().split()))
	a.sort()
	idx = bisect.bisect_left(a,0)
	if idx == 0:
		idx = 1
	elif idx == n:
		idx = -1
	cur_min = a[0]
	cur_max = a[-1]
	res = []
	for n in a[1:idx]:
		res.append('{} {}'.format(cur_max,n))
		cur_max -= n
	for n in a[idx:-1]:
		res.append('{} {}'.format(cur_min,n))
		cur_min -= n
	res.append('{} {}'.format(cur_max,cur_min))
	print(cur_max-cur_min)
	for r in res:
		print(r) def main():
	n = int(input())
	a = list(map(int,input().split()))
	a.sort()
	idx = bisect.bisect_left(a,0)
	if idx == 0:
		idx = 1
	elif idx == n:
		idx = -1
	cur_min = a[0]
	cur_max = a[-1]
	res = []
	for n in a[1:idx]:
		res.append('{} {}'.format(cur_max,n))
		cur_max -= n
	for n in a[idx:-1]:
		res.append('{} {}'.format(cur_min,n))
		cur_min -= n
	res.append('{} {}'.format(cur_max,cur_min))
	print(cur_max-cur_min)
	for r in res:
		print(r) main
import bisect

def main():
	n = int(input())
	a = list(map(int,input().split()))
	a.sort()
	idx = bisect.bisect_left(a,0)
	if idx == 0:
		idx = 1
	elif idx == n:
		idx = -1
	cur_min = a[0]
	cur_max = a[-1]
	res = []
	for n in a[1:idx]:
		res.append('{} {}'.format(cur_max,n))
		cur_max -= n
	for n in a[idx:-1]:
		res.append('{} {}'.format(cur_min,n))
		cur_min -= n
	res.append('{} {}'.format(cur_max,cur_min))
	print(cur_max-cur_min)
	for r in res:
		print(r)

if __name__ == '__main__':
	main()