N = int(input())
A = list(map(int, input().split()))
ap = []; am = []
for a in A:
  if a > 0:
    ap.append(a)
  else:
    am.append(a)

if ap and am:
  print(sum(ap) - sum(am))
  ap_last = ap.pop()
  am_base = am.pop()
  while ap:
    a = ap.pop()
    print(am_base, a)
    am_base -= a
  print(ap_last, am_base)
  ap_last -= am_base
  while am:
    a = am.pop()
    print(ap_last, a)
    ap_last -= a
elif ap:
  ap.sort(reverse=True)
  ap_base = ap.pop()
  print(sum(ap) - ap_base)
  ap_last = ap.pop()
  while ap:
    a = ap.pop()
    print(ap_base, a)
    ap_base -= a
  print(ap_last, ap_base)
else:
  am.sort()
  am_base = am.pop()
  print(am_base - sum(am))
  while am:
    a = am.pop()
    print(am_base, a)
    am_base -= a 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 ap = [] ap [] am = [] am [] for a in A:
  if a > 0:
    ap.append(a)
  else:
    am.append(a) a A if a > 0:
    ap.append(a)
  else:
    am.append(a) a > 0 a 0 ap.append(a) ap.append ap append a am.append(a) am.append am append a if ap and am:
  print(sum(ap) - sum(am))
  ap_last = ap.pop()
  am_base = am.pop()
  while ap:
    a = ap.pop()
    print(am_base, a)
    am_base -= a
  print(ap_last, am_base)
  ap_last -= am_base
  while am:
    a = am.pop()
    print(ap_last, a)
    ap_last -= a
elif ap:
  ap.sort(reverse=True)
  ap_base = ap.pop()
  print(sum(ap) - ap_base)
  ap_last = ap.pop()
  while ap:
    a = ap.pop()
    print(ap_base, a)
    ap_base -= a
  print(ap_last, ap_base)
else:
  am.sort()
  am_base = am.pop()
  print(am_base - sum(am))
  while am:
    a = am.pop()
    print(am_base, a)
    am_base -= a ap and am ap am print(sum(ap) - sum(am)) print sum(ap) - sum(am) sum(ap) sum ap sum(am) sum am ap_last = ap.pop() ap_last ap.pop() ap.pop ap pop am_base = am.pop() am_base am.pop() am.pop am pop while ap:
    a = ap.pop()
    print(am_base, a)
    am_base -= a
   ap a = ap.pop() a ap.pop() ap.pop ap pop print(am_base, a) print am_base a am_base -= a am_base a print(ap_last, am_base) print ap_last am_base ap_last -= am_base ap_last am_base while am:
    a = am.pop()
    print(ap_last, a)
    ap_last -= a am a = am.pop() a am.pop() am.pop am pop print(ap_last, a) print ap_last a ap_last -= a ap_last a elif ap:
  ap.sort(reverse=True)
  ap_base = ap.pop()
  print(sum(ap) - ap_base)
  ap_last = ap.pop()
  while ap:
    a = ap.pop()
    print(ap_base, a)
    ap_base -= a
  print(ap_last, ap_base) ap ap.sort(reverse=True) ap.sort ap sort reverse=True reverse True ap_base = ap.pop() ap_base ap.pop() ap.pop ap pop print(sum(ap) - ap_base) print sum(ap) - ap_base sum(ap) sum ap ap_base ap_last = ap.pop() ap_last ap.pop() ap.pop ap pop while ap:
    a = ap.pop()
    print(ap_base, a)
    ap_base -= a
   ap a = ap.pop() a ap.pop() ap.pop ap pop print(ap_base, a) print ap_base a ap_base -= a ap_base a print(ap_last, ap_base) print ap_last ap_base am.sort() am.sort am sort am_base = am.pop() am_base am.pop() am.pop am pop print(am_base - sum(am)) print am_base - sum(am) am_base sum(am) sum am while am:
    a = am.pop()
    print(am_base, a)
    am_base -= a am a = am.pop() a am.pop() am.pop am pop print(am_base, a) print am_base a am_base -= a am_base a am_base -= a a am_base am = [] [] am ap_last -= am_base am_base ap_last am_base -= a a am_base ap_base = ap.pop() ap.pop() ap_base ap_last = ap.pop() ap.pop() ap_last ap = [] [] ap a = ap.pop() ap.pop() a a = am.pop() am.pop() a a = ap.pop() ap.pop() a am_base = am.pop() am.pop() am_base ap_last -= a a ap_last N = int(input()) int(input()) N a = am.pop() am.pop() a A = list(map(int, input().split())) list(map(int, input().split())) A ap_base -= a a ap_base ap_last = ap.pop() ap.pop() ap_last am_base = am.pop() am.pop() am_base
N = int(input())
A = list(map(int, input().split()))
ap = []; am = []
for a in A:
  if a > 0:
    ap.append(a)
  else:
    am.append(a)

if ap and am:
  print(sum(ap) - sum(am))
  ap_last = ap.pop()
  am_base = am.pop()
  while ap:
    a = ap.pop()
    print(am_base, a)
    am_base -= a
  print(ap_last, am_base)
  ap_last -= am_base
  while am:
    a = am.pop()
    print(ap_last, a)
    ap_last -= a
elif ap:
  ap.sort(reverse=True)
  ap_base = ap.pop()
  print(sum(ap) - ap_base)
  ap_last = ap.pop()
  while ap:
    a = ap.pop()
    print(ap_base, a)
    ap_base -= a
  print(ap_last, ap_base)
else:
  am.sort()
  am_base = am.pop()
  print(am_base - sum(am))
  while am:
    a = am.pop()
    print(am_base, a)
    am_base -= a