n = int(input())
a = list(map(int,input().split()))
a.sort()
ret = 0
method = []

ret = a[0]
d = 2
while d < n and a[-d] > 0:
  method.append((ret, a[-d]))
  ret -= a[-d]
  d += 1
method.append((a[-1], ret))
ret = a[-1] - ret
for i in range(1, n-d+1):
  method.append((ret, a[i]))
  ret -= a[i]

print(ret)
for t in method: print(*t) 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 ret = 0 ret 0 method = [] method [] ret = a[0] ret a[0] a 0 d = 2 d 2 while d < n and a[-d] > 0:
  method.append((ret, a[-d]))
  ret -= a[-d]
  d += 1 d < n and a[-d] > 0 d < n d n a[-d] > 0 a[-d] a -d d 0 method.append((ret, a[-d])) method.append method append (ret, a[-d]) ret a[-d] a -d d ret -= a[-d] ret a[-d] a -d d d += 1 d 1 method.append((a[-1], ret)) method.append method append (a[-1], ret) a[-1] a -1 ret ret = a[-1] - ret ret a[-1] - ret a[-1] a -1 ret for i in range(1, n-d+1):
  method.append((ret, a[i]))
  ret -= a[i] i range(1, n-d+1) range 1 n-d+1 n-d n d 1 method.append((ret, a[i])) method.append method append (ret, a[i]) ret a[i] a i ret -= a[i] ret a[i] a i print(ret) print ret for t in method: print(*t) t method ret = 0 0 ret d = 2 2 d ret = a[-1] - ret a[-1] - ret ret a = list(map(int,input().split())) list(map(int,input().split())) a ret -= a[i] a[i] ret method = [] [] method ret = a[0] a[0] ret ret -= a[-d] a[-d] ret n = int(input()) int(input()) n d += 1 1 d
n = int(input())
a = list(map(int,input().split()))
a.sort()
ret = 0
method = []

ret = a[0]
d = 2
while d < n and a[-d] > 0:
  method.append((ret, a[-d]))
  ret -= a[-d]
  d += 1
method.append((a[-1], ret))
ret = a[-1] - ret
for i in range(1, n-d+1):
  method.append((ret, a[i]))
  ret -= a[i]

print(ret)
for t in method: print(*t)
