import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

plus = []
minus = []

for a in A:
    if a >= 0:
        plus.append(a)
    else:
        minus.append(a)
if not plus:
    mm = max(minus)
    plus.append(mm)
    minus.remove(mm)
if not minus:
    mp = min(plus)
    minus.append(mp)
    plus.remove(mp)

hist = []
x = minus.pop()
while len(plus) > 1:
    y = plus.pop()
    hist.append((x, y))
    x = x - y
minus.append(x)

x = plus.pop()
while len(minus) > 1:
    y = minus.pop()
    hist.append((x, y))
    x = x - y
y = minus.pop()
hist.append((x, y))

print(x - y)
for h in hist:
    print(*h) import bisect bisect import os os from collections import Counter, deque from fractions import gcd from functools import lru_cache from functools import reduce import functools functools import heapq heapq import itertools itertools import math math import numpy as np numpy import re re import string string import sys sys if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r") os.getenv("LOCAL") os.getenv os getenv "LOCAL" sys.stdin = open("_in.txt", "r") sys.stdin sys stdin open("_in.txt", "r") open "_in.txt" "r" sys.setrecursionlimit(2147483647) sys.setrecursionlimit sys setrecursionlimit 2147483647 INF = float("inf") INF float("inf") float "inf" N = int(sys.stdin.readline()) N int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline A = list(map(int, sys.stdin.readline().split())) A list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split plus = [] plus [] minus = [] minus [] for a in A:
    if a >= 0:
        plus.append(a)
    else:
        minus.append(a) a A if a >= 0:
        plus.append(a)
    else:
        minus.append(a) a >= 0 a 0 plus.append(a) plus.append plus append a minus.append(a) minus.append minus append a if not plus:
    mm = max(minus)
    plus.append(mm)
    minus.remove(mm) not plus plus mm = max(minus) mm max(minus) max minus plus.append(mm) plus.append plus append mm minus.remove(mm) minus.remove minus remove mm if not minus:
    mp = min(plus)
    minus.append(mp)
    plus.remove(mp) not minus minus mp = min(plus) mp min(plus) min plus minus.append(mp) minus.append minus append mp plus.remove(mp) plus.remove plus remove mp hist = [] hist [] x = minus.pop() x minus.pop() minus.pop minus pop while len(plus) > 1:
    y = plus.pop()
    hist.append((x, y))
    x = x - y len(plus) > 1 len(plus) len plus 1 y = plus.pop() y plus.pop() plus.pop plus pop hist.append((x, y)) hist.append hist append (x, y) x y x = x - y x x - y x y minus.append(x) minus.append minus append x x = plus.pop() x plus.pop() plus.pop plus pop while len(minus) > 1:
    y = minus.pop()
    hist.append((x, y))
    x = x - y len(minus) > 1 len(minus) len minus 1 y = minus.pop() y minus.pop() minus.pop minus pop hist.append((x, y)) hist.append hist append (x, y) x y x = x - y x x - y x y y = minus.pop() y minus.pop() minus.pop minus pop hist.append((x, y)) hist.append hist append (x, y) x y print(x - y) print x - y x y for h in hist:
    print(*h) h hist print(*h) print *h h N = int(sys.stdin.readline()) int(sys.stdin.readline()) N mp = min(plus) min(plus) mp y = minus.pop() minus.pop() y minus = [] [] minus x = plus.pop() plus.pop() x mm = max(minus) max(minus) mm A = list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) A y = plus.pop() plus.pop() y x = minus.pop() minus.pop() x y = minus.pop() minus.pop() y x = x - y x - y x hist = [] [] hist INF = float("inf") float("inf") INF x = x - y x - y x plus = [] [] plus
import bisect
import os
from collections import Counter, deque
from fractions import gcd
from functools import lru_cache
from functools import reduce
import functools
import heapq
import itertools
import math
import numpy as np
import re
import string
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)
INF = float("inf")

N = int(sys.stdin.readline())
A = list(map(int, sys.stdin.readline().split()))

plus = []
minus = []

for a in A:
    if a >= 0:
        plus.append(a)
    else:
        minus.append(a)
if not plus:
    mm = max(minus)
    plus.append(mm)
    minus.remove(mm)
if not minus:
    mp = min(plus)
    minus.append(mp)
    plus.remove(mp)

hist = []
x = minus.pop()
while len(plus) > 1:
    y = plus.pop()
    hist.append((x, y))
    x = x - y
minus.append(x)

x = plus.pop()
while len(minus) > 1:
    y = minus.pop()
    hist.append((x, y))
    x = x - y
y = minus.pop()
hist.append((x, y))

print(x - y)
for h in hist:
    print(*h)
