n = int(input())
a = [int(i) for i in input().split()]
a.sort()

out = ""

minus = [a[0]]
plus = [a[-1]]

for v in a[1:-1]:
    if v < 0:
        minus.append(v)
    else:
        plus.append(v)

# (plus[0] - (minus[0] - plus[n])) - minus[n]
base_minus = minus.pop(0)
base_plus = plus.pop(0)
for i in range(len(plus)):
    x = base_minus
    y = plus[i]
    out += "{} {}\n".format(x, y)
    base_minus = x - y

out += "{} {}\n".format(base_plus, base_minus)
base_plus -= base_minus

for i in range(len(minus)):
    x = base_plus
    y = minus[i]
    out += "{} {}\n".format(x, y)
    base_plus = x - y
print(base_plus)
print(out) n = int(input()) n int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i a = [int(i) for i in input().split()] a [int(i) for i in input().split()] a.sort() a.sort a sort out = "" out "" minus = [a[0]] minus [a[0]] a[0] a 0 plus = [a[-1]] plus [a[-1]] a[-1] a -1 for v in a[1:-1]:
    if v < 0:
        minus.append(v)
    else:
        plus.append(v)

# (plus[0] - (minus[0] - plus[n])) - minus[n] v a[1:-1] a 1:-1 1 -1 if v < 0:
        minus.append(v)
    else:
        plus.append(v)

# (plus[0] - (minus[0] - plus[n])) - minus[n] v < 0 v 0 minus.append(v) minus.append minus append v plus.append(v) plus.append plus append v base_minus = minus.pop(0) base_minus minus.pop(0) minus.pop minus pop 0 base_plus = plus.pop(0) base_plus plus.pop(0) plus.pop plus pop 0 for i in range(len(plus)):
    x = base_minus
    y = plus[i]
    out += "{} {}\n".format(x, y)
    base_minus = x - y i range(len(plus)) range len(plus) len plus x = base_minus x base_minus y = plus[i] y plus[i] plus i out += "{} {}\n".format(x, y) out "{} {}\n".format(x, y) "{} {}\n".format "{} {}\n" format x y base_minus = x - y base_minus x - y x y out += "{} {}\n".format(base_plus, base_minus) out "{} {}\n".format(base_plus, base_minus) "{} {}\n".format "{} {}\n" format base_plus base_minus base_plus -= base_minus base_plus base_minus for i in range(len(minus)):
    x = base_plus
    y = minus[i]
    out += "{} {}\n".format(x, y)
    base_plus = x - y i range(len(minus)) range len(minus) len minus x = base_plus x base_plus y = minus[i] y minus[i] minus i out += "{} {}\n".format(x, y) out "{} {}\n".format(x, y) "{} {}\n".format "{} {}\n" format x y base_plus = x - y base_plus x - y x y print(base_plus) print base_plus print(out) print out base_plus = plus.pop(0) plus.pop(0) base_plus x = base_plus base_plus x y = minus[i] minus[i] y y = plus[i] plus[i] y out += "{} {}\n".format(x, y) "{} {}\n".format(x, y) out out = "" "" out base_minus = x - y x - y base_minus out += "{} {}\n".format(base_plus, base_minus) "{} {}\n".format(base_plus, base_minus) out out += "{} {}\n".format(x, y) "{} {}\n".format(x, y) out base_plus -= base_minus base_minus base_plus base_minus = minus.pop(0) minus.pop(0) base_minus a = [int(i) for i in input().split()] [int(i) for i in input().split()] a plus = [a[-1]] [a[-1]] plus n = int(input()) int(input()) n minus = [a[0]] [a[0]] minus base_plus = x - y x - y base_plus x = base_minus base_minus x
n = int(input())
a = [int(i) for i in input().split()]
a.sort()

out = ""

minus = [a[0]]
plus = [a[-1]]

for v in a[1:-1]:
    if v < 0:
        minus.append(v)
    else:
        plus.append(v)

# (plus[0] - (minus[0] - plus[n])) - minus[n]
base_minus = minus.pop(0)
base_plus = plus.pop(0)
for i in range(len(plus)):
    x = base_minus
    y = plus[i]
    out += "{} {}\n".format(x, y)
    base_minus = x - y

out += "{} {}\n".format(base_plus, base_minus)
base_plus -= base_minus

for i in range(len(minus)):
    x = base_plus
    y = minus[i]
    out += "{} {}\n".format(x, y)
    base_plus = x - y
print(base_plus)
print(out)