n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ans = [0]*(n-1)

k1, k2 = a[0], a[-1]
for i in range(1, n-1):
  if a[i] >= 0:
    ans[i-1] = (k1, a[i])
    k1 -= a[i]
  else:
    ans[i-1] = (k2, a[i])
    k2 -= a[i]
ans[n-2] = (k2, k1)
print(k2-k1)
for value in ans:
  print(*value) n = int(input()) n int(input()) int input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x a = [int(x) for x in input().split()] a [int(x) for x in input().split()] a.sort() a.sort a sort ans = [0]*(n-1) ans [0]*(n-1) [0] 0 n-1 n 1 k1, k2 = a[0], a[-1] k1 a[0] a 0 k2 a[-1] a -1 for i in range(1, n-1):
  if a[i] >= 0:
    ans[i-1] = (k1, a[i])
    k1 -= a[i]
  else:
    ans[i-1] = (k2, a[i])
    k2 -= a[i] i range(1, n-1) range 1 n-1 n 1 if a[i] >= 0:
    ans[i-1] = (k1, a[i])
    k1 -= a[i]
  else:
    ans[i-1] = (k2, a[i])
    k2 -= a[i] a[i] >= 0 a[i] a i 0 ans[i-1] = (k1, a[i]) ans[i-1] ans i-1 i 1 (k1, a[i]) k1 a[i] a i k1 -= a[i] k1 a[i] a i ans[i-1] = (k2, a[i]) ans[i-1] ans i-1 i 1 (k2, a[i]) k2 a[i] a i k2 -= a[i] k2 a[i] a i ans[n-2] = (k2, k1) ans[n-2] ans n-2 n 2 (k2, k1) k2 k1 print(k2-k1) print k2-k1 k2 k1 for value in ans:
  print(*value) value ans print(*value) print *value value k1, k2 = a[0], a[-1] a[0] k1 a = [int(x) for x in input().split()] [int(x) for x in input().split()] a ans = [0]*(n-1) [0]*(n-1) ans k2 = a[0], a[-1] a[-1] k2 k1 -= a[i] a[i] k1 n = int(input()) int(input()) n k2 -= a[i] a[i] k2
n = int(input())
a = [int(x) for x in input().split()]
a.sort()
ans = [0]*(n-1)

k1, k2 = a[0], a[-1]
for i in range(1, n-1):
  if a[i] >= 0:
    ans[i-1] = (k1, a[i])
    k1 -= a[i]
  else:
    ans[i-1] = (k2, a[i])
    k2 -= a[i]
ans[n-2] = (k2, k1)
print(k2-k1)
for value in ans:
  print(*value)