N = int(input())
a = list(map(int, input().split()))
p = [t for t in a if t >= 0]
m = [t for t in a if t < 0]
p.sort(reverse = True)
m.sort()
l = []
if N == 2:
  print(max(a) - min(a))
  print(max(a), min(a))
  exit(0)
if len(p) == 0:
  u = m.pop()
  v = m.pop()
  l.append((u, v))
  p.append(u - v)
if len(m) == 0 and len(p) >= 2:
  u = p.pop()
  v = p.pop()
  l.append((u, v))
  m.append(u - v)
while len(p) >= 2:
  u = m.pop()
  v = p.pop()
  l.append((u, v))
  m.append(u - v)
while len(m):
  t = p[0]
  u = m.pop()
  l.append((t, u))
  p[0] = t - u
print(p[0])
for res in l:
  print(*res) 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 t for t in a if t >= 0 for t in a if t >= 0 t a t >= 0 t 0 if t >= 0 t p = [t for t in a if t >= 0] p [t for t in a if t >= 0] t for t in a if t < 0 for t in a if t < 0 t a t < 0 t 0 if t < 0 t m = [t for t in a if t < 0] m [t for t in a if t < 0] p.sort(reverse = True) p.sort p sort reverse = True reverse True m.sort() m.sort m sort l = [] l [] if N == 2:
  print(max(a) - min(a))
  print(max(a), min(a))
  exit(0) N == 2 N 2 print(max(a) - min(a)) print max(a) - min(a) max(a) max a min(a) min a print(max(a), min(a)) print max(a) max a min(a) min a exit(0) exit 0 if len(p) == 0:
  u = m.pop()
  v = m.pop()
  l.append((u, v))
  p.append(u - v) len(p) == 0 len(p) len p 0 u = m.pop() u m.pop() m.pop m pop v = m.pop() v m.pop() m.pop m pop l.append((u, v)) l.append l append (u, v) u v p.append(u - v) p.append p append u - v u v if len(m) == 0 and len(p) >= 2:
  u = p.pop()
  v = p.pop()
  l.append((u, v))
  m.append(u - v) len(m) == 0 and len(p) >= 2 len(m) == 0 len(m) len m 0 len(p) >= 2 len(p) len p 2 u = p.pop() u p.pop() p.pop p pop v = p.pop() v p.pop() p.pop p pop l.append((u, v)) l.append l append (u, v) u v m.append(u - v) m.append m append u - v u v while len(p) >= 2:
  u = m.pop()
  v = p.pop()
  l.append((u, v))
  m.append(u - v) len(p) >= 2 len(p) len p 2 u = m.pop() u m.pop() m.pop m pop v = p.pop() v p.pop() p.pop p pop l.append((u, v)) l.append l append (u, v) u v m.append(u - v) m.append m append u - v u v while len(m):
  t = p[0]
  u = m.pop()
  l.append((t, u))
  p[0] = t - u len(m) len m t = p[0] t p[0] p 0 u = m.pop() u m.pop() m.pop m pop l.append((t, u)) l.append l append (t, u) t u p[0] = t - u p[0] p 0 t - u t u print(p[0]) print p[0] p 0 for res in l:
  print(*res) res l print(*res) print *res res v = p.pop() p.pop() v l = [] [] l u = m.pop() m.pop() u N = int(input()) int(input()) N v = p.pop() p.pop() v a = list(map(int, input().split())) list(map(int, input().split())) a p = [t for t in a if t >= 0] [t for t in a if t >= 0] p t = p[0] p[0] t v = m.pop() m.pop() v u = p.pop() p.pop() u m = [t for t in a if t < 0] [t for t in a if t < 0] m u = m.pop() m.pop() u u = m.pop() m.pop() u
N = int(input())
a = list(map(int, input().split()))
p = [t for t in a if t >= 0]
m = [t for t in a if t < 0]
p.sort(reverse = True)
m.sort()
l = []
if N == 2:
  print(max(a) - min(a))
  print(max(a), min(a))
  exit(0)
if len(p) == 0:
  u = m.pop()
  v = m.pop()
  l.append((u, v))
  p.append(u - v)
if len(m) == 0 and len(p) >= 2:
  u = p.pop()
  v = p.pop()
  l.append((u, v))
  m.append(u - v)
while len(p) >= 2:
  u = m.pop()
  v = p.pop()
  l.append((u, v))
  m.append(u - v)
while len(m):
  t = p[0]
  u = m.pop()
  l.append((t, u))
  p[0] = t - u
print(p[0])
for res in l:
  print(*res)