N=int(input())
A=list(map(int, input().split()))
A.sort()
P=sum([1 for a in A if a >= 0])
Q=N-P
if P==0:
  P=1
  Q=N-1
elif Q==0:
  P=N-1
  Q=1
ans=[]
for y in range(Q, N-1):
  ans.append((A[0], A[y]))
  A[0]=A[0]-A[y]

for y in range(Q):
  ans.append((A[N-1],A[y]))
  A[N-1]=A[N-1]-A[y]

print(A[N-1])
for x in ans:
  print(*x) 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 1 for a in A if a >= 0 for a in A if a >= 0 a A a >= 0 a 0 if a >= 0 1 P=sum([1 for a in A if a >= 0]) P sum([1 for a in A if a >= 0]) sum [1 for a in A if a >= 0] Q=N-P Q N-P N P if P==0:
  P=1
  Q=N-1
elif Q==0:
  P=N-1
  Q=1 P==0 P 0 P=1 P 1 Q=N-1 Q N-1 N 1 elif Q==0:
  P=N-1
  Q=1 Q==0 Q 0 P=N-1 P N-1 N 1 Q=1 Q 1 ans=[] ans [] for y in range(Q, N-1):
  ans.append((A[0], A[y]))
  A[0]=A[0]-A[y] y range(Q, N-1) range Q N-1 N 1 ans.append((A[0], A[y])) ans.append ans append (A[0], A[y]) A[0] A 0 A[y] A y A[0]=A[0]-A[y] A[0] A 0 A[0]-A[y] A[0] A 0 A[y] A y for y in range(Q):
  ans.append((A[N-1],A[y]))
  A[N-1]=A[N-1]-A[y] y range(Q) range Q ans.append((A[N-1],A[y])) ans.append ans append (A[N-1],A[y]) A[N-1] A N-1 N 1 A[y] A y A[N-1]=A[N-1]-A[y] A[N-1] A N-1 N 1 A[N-1]-A[y] A[N-1] A N-1 N 1 A[y] A y print(A[N-1]) print A[N-1] A N-1 N 1 for x in ans:
  print(*x) x ans print(*x) print *x x P=N-1 N-1 P Q=N-P N-P Q N=int(input()) int(input()) N A=list(map(int, input().split())) list(map(int, input().split())) A Q=1 1 Q ans=[] [] ans P=sum([1 for a in A if a >= 0]) sum([1 for a in A if a >= 0]) P Q=N-1 N-1 Q P=1 1 P
N=int(input())
A=list(map(int, input().split()))
A.sort()
P=sum([1 for a in A if a >= 0])
Q=N-P
if P==0:
  P=1
  Q=N-1
elif Q==0:
  P=N-1
  Q=1
ans=[]
for y in range(Q, N-1):
  ans.append((A[0], A[y]))
  A[0]=A[0]-A[y]

for y in range(Q):
  ans.append((A[N-1],A[y]))
  A[N-1]=A[N-1]-A[y]

print(A[N-1])
for x in ans:
  print(*x)