n = int(input())
a = list(map(int, input().split()))
a.sort()
ps = []
ms = []

cnt = 0
ans = 0
anss = []
for e in a:
  if e<0:
    cnt += 1
    ms.append(e)
  else:
    ps.append(e)
  ans += abs(e)
if cnt==n:
  ans += a[n-1]*2
elif cnt==0:
  ans -= a[0]*2
print(ans)

if cnt==0:
  cur = a[0]
  a.remove(cur)
  for i in range(n-2):
    print(cur, a[i])
    cur = cur-a[i]
  print(a[n-2], cur)
elif cnt==n:
  cur = a[n-1]
  a.remove(cur)
  for i in range(n-1):
    print(cur, a[i])
    cur = cur-a[i]
else:
  while len(ps)>1:
    t = ps.pop()
    print(ms[0], t)
    ms[0] -= t
  while len(ms):
    t = ms.pop()
    print(ps[0], t)
    ps[0] -= t

for e in anss:
  print(*e) 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 ps = [] ps [] ms = [] ms [] cnt = 0 cnt 0 ans = 0 ans 0 anss = [] anss [] for e in a:
  if e<0:
    cnt += 1
    ms.append(e)
  else:
    ps.append(e)
  ans += abs(e) e a if e<0:
    cnt += 1
    ms.append(e)
  else:
    ps.append(e)
   e<0 e 0 cnt += 1 cnt 1 ms.append(e) ms.append ms append e ps.append(e) ps.append ps append e ans += abs(e) ans abs(e) abs e if cnt==n:
  ans += a[n-1]*2
elif cnt==0:
  ans -= a[0]*2 cnt==n cnt n ans += a[n-1]*2 ans a[n-1]*2 a[n-1] a n-1 n 1 2 elif cnt==0:
  ans -= a[0]*2 cnt==0 cnt 0 ans -= a[0]*2 ans a[0]*2 a[0] a 0 2 print(ans) print ans if cnt==0:
  cur = a[0]
  a.remove(cur)
  for i in range(n-2):
    print(cur, a[i])
    cur = cur-a[i]
  print(a[n-2], cur)
elif cnt==n:
  cur = a[n-1]
  a.remove(cur)
  for i in range(n-1):
    print(cur, a[i])
    cur = cur-a[i]
else:
  while len(ps)>1:
    t = ps.pop()
    print(ms[0], t)
    ms[0] -= t
  while len(ms):
    t = ms.pop()
    print(ps[0], t)
    ps[0] -= t cnt==0 cnt 0 cur = a[0] cur a[0] a 0 a.remove(cur) a.remove a remove cur for i in range(n-2):
    print(cur, a[i])
    cur = cur-a[i]
   i range(n-2) range n-2 n 2 print(cur, a[i]) print cur a[i] a i cur = cur-a[i] cur cur-a[i] cur a[i] a i print(a[n-2], cur) print a[n-2] a n-2 n 2 cur elif cnt==n:
  cur = a[n-1]
  a.remove(cur)
  for i in range(n-1):
    print(cur, a[i])
    cur = cur-a[i] cnt==n cnt n cur = a[n-1] cur a[n-1] a n-1 n 1 a.remove(cur) a.remove a remove cur for i in range(n-1):
    print(cur, a[i])
    cur = cur-a[i] i range(n-1) range n-1 n 1 print(cur, a[i]) print cur a[i] a i cur = cur-a[i] cur cur-a[i] cur a[i] a i while len(ps)>1:
    t = ps.pop()
    print(ms[0], t)
    ms[0] -= t
   len(ps)>1 len(ps) len ps 1 t = ps.pop() t ps.pop() ps.pop ps pop print(ms[0], t) print ms[0] ms 0 t ms[0] -= t ms[0] ms 0 t while len(ms):
    t = ms.pop()
    print(ps[0], t)
    ps[0] -= t len(ms) len ms t = ms.pop() t ms.pop() ms.pop ms pop print(ps[0], t) print ps[0] ps 0 t ps[0] -= t ps[0] ps 0 t for e in anss:
  print(*e) e anss print(*e) print *e e ans += a[n-1]*2 a[n-1]*2 ans ps = [] [] ps cur = a[n-1] a[n-1] cur ms = [] [] ms a = list(map(int, input().split())) list(map(int, input().split())) a ans = 0 0 ans cnt += 1 1 cnt ans -= a[0]*2 a[0]*2 ans cur = cur-a[i] cur-a[i] cur cur = a[0] a[0] cur cur = cur-a[i] cur-a[i] cur cnt = 0 0 cnt ans += abs(e) abs(e) ans anss = [] [] anss t = ms.pop() ms.pop() t n = int(input()) int(input()) n t = ps.pop() ps.pop() t
n = int(input())
a = list(map(int, input().split()))
a.sort()
ps = []
ms = []

cnt = 0
ans = 0
anss = []
for e in a:
  if e<0:
    cnt += 1
    ms.append(e)
  else:
    ps.append(e)
  ans += abs(e)
if cnt==n:
  ans += a[n-1]*2
elif cnt==0:
  ans -= a[0]*2
print(ans)

if cnt==0:
  cur = a[0]
  a.remove(cur)
  for i in range(n-2):
    print(cur, a[i])
    cur = cur-a[i]
  print(a[n-2], cur)
elif cnt==n:
  cur = a[n-1]
  a.remove(cur)
  for i in range(n-1):
    print(cur, a[i])
    cur = cur-a[i]
else:
  while len(ps)>1:
    t = ps.pop()
    print(ms[0], t)
    ms[0] -= t
  while len(ms):
    t = ms.pop()
    print(ps[0], t)
    ps[0] -= t

for e in anss:
  print(*e)
