n = int(input())
arr = sorted(list(map(int, input().split())))

m = arr[0]
M = arr[-1]
S = []
for a in arr[1:-1]:
  if a > 0:
    S.append(str(m) + ' ' + str(a))
    m -= a
  else:
    S.append(str(M) + ' ' + str(a))
    M -= a
S.append(str(M) + ' ' + str(m))
print(M-m)
[print(s) for s in S]
 n = int(input()) n int(input()) int input() input arr = sorted(list(map(int, input().split()))) arr sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split m = arr[0] m arr[0] arr 0 M = arr[-1] M arr[-1] arr -1 S = [] S [] for a in arr[1:-1]:
  if a > 0:
    S.append(str(m) + ' ' + str(a))
    m -= a
  else:
    S.append(str(M) + ' ' + str(a))
    M -= a a arr[1:-1] arr 1:-1 1 -1 if a > 0:
    S.append(str(m) + ' ' + str(a))
    m -= a
  else:
    S.append(str(M) + ' ' + str(a))
    M -= a a > 0 a 0 S.append(str(m) + ' ' + str(a)) S.append S append str(m) + ' ' + str(a) str(m) + ' ' str(m) str m ' ' str(a) str a m -= a m a S.append(str(M) + ' ' + str(a)) S.append S append str(M) + ' ' + str(a) str(M) + ' ' str(M) str M ' ' str(a) str a M -= a M a S.append(str(M) + ' ' + str(m)) S.append S append str(M) + ' ' + str(m) str(M) + ' ' str(M) str M ' ' str(m) str m print(M-m) print M-m M m print(s) for s in S for s in S s S for s in S print(s) print s [print(s) for s in S] M -= a a M M = arr[-1] arr[-1] M arr = sorted(list(map(int, input().split()))) sorted(list(map(int, input().split()))) arr m -= a a m n = int(input()) int(input()) n m = arr[0] arr[0] m S = [] [] S
n = int(input())
arr = sorted(list(map(int, input().split())))

m = arr[0]
M = arr[-1]
S = []
for a in arr[1:-1]:
  if a > 0:
    S.append(str(m) + ' ' + str(a))
    m -= a
  else:
    S.append(str(M) + ' ' + str(a))
    M -= a
S.append(str(M) + ' ' + str(m))
print(M-m)
[print(s) for s in S]

