n = int(input())
a = list(map(int, input().split()))

a.sort()

posi = [a[-1]]
nega = [a[0]]

for n in a[1:-1]:
  if n < 0:
    nega.append(n)
  else:
    posi.append(n)

selected = []
ans = nega[0]

for n in posi[1:]:
  (x, y) = ans, n
  ans = x - y
  selected.append((x, y))

nega.append(ans)

ans = posi[0]
for n in nega[1:]:
  (x, y) = ans, n
  ans = x - y
  selected.append((x, y))

print(ans)

for (x, y) in selected:
  print(str(x) + ' ' + str(y))

 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 posi = [a[-1]] posi [a[-1]] a[-1] a -1 nega = [a[0]] nega [a[0]] a[0] a 0 for n in a[1:-1]:
  if n < 0:
    nega.append(n)
  else:
    posi.append(n) n a[1:-1] a 1:-1 1 -1 if n < 0:
    nega.append(n)
  else:
    posi.append(n) n < 0 n 0 nega.append(n) nega.append nega append n posi.append(n) posi.append posi append n selected = [] selected [] ans = nega[0] ans nega[0] nega 0 for n in posi[1:]:
  (x, y) = ans, n
  ans = x - y
  selected.append((x, y)) n posi[1:] posi 1: 1 (x, y) = ans, n (x, y) x y (x, y) = ans, n ans n ans = x - y ans x - y x y selected.append((x, y)) selected.append selected append (x, y) x y nega.append(ans) nega.append nega append ans ans = posi[0] ans posi[0] posi 0 for n in nega[1:]:
  (x, y) = ans, n
  ans = x - y
  selected.append((x, y)) n nega[1:] nega 1: 1 (x, y) = ans, n (x, y) x y (x, y) = ans, n ans n ans = x - y ans x - y x y selected.append((x, y)) selected.append selected append (x, y) x y print(ans) print ans for (x, y) in selected:
  print(str(x) + ' ' + str(y)) (x, y) x y selected print(str(x) + ' ' + str(y)) print str(x) + ' ' + str(y) str(x) + ' ' str(x) str x ' ' str(y) str y ans = x - y x - y ans selected = [] [] selected ans = nega[0] nega[0] ans ans = posi[0] posi[0] ans n = int(input()) int(input()) n a = list(map(int, input().split())) list(map(int, input().split())) a posi = [a[-1]] [a[-1]] posi ans = x - y x - y ans nega = [a[0]] [a[0]] nega
n = int(input())
a = list(map(int, input().split()))

a.sort()

posi = [a[-1]]
nega = [a[0]]

for n in a[1:-1]:
  if n < 0:
    nega.append(n)
  else:
    posi.append(n)

selected = []
ans = nega[0]

for n in posi[1:]:
  (x, y) = ans, n
  ans = x - y
  selected.append((x, y))

nega.append(ans)

ans = posi[0]
for n in nega[1:]:
  (x, y) = ans, n
  ans = x - y
  selected.append((x, y))

print(ans)

for (x, y) in selected:
  print(str(x) + ' ' + str(y))


