N = int(input())
A = list(map(int,input().split()))

## 2個しかない場合
if N == 2:
  A.sort()
  print(A[-1] - A[0])
  print(A[-1], A[0])
  exit()

## 全部非負整数の場合
if sum(a < 0 for a in A) == 0:
  A.sort()
  solver = []
  var = A[0]
  for i in range(1,N-1):
    solver.append((var, A[i]))
    var = var - A[i]
  else:
    solver.append((A[-1], var))
    var = A[-1] - var

  print(var)
  for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
  exit()
  
## 全部非正整数の場合
if sum(a > 0 for a in A) == 0:
  A.sort(reverse=True)
  solver = []
  var = A[0]
  for i in range(1,N):
    solver.append((var, A[i]))
    var = var - A[i]

  print(var)
  for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
  exit()
  
## 正整数も負整数もある場合
A.sort()
n_nega = sum(a < 0 for a in A)
n_posi = sum(a > 0 for a in A)
solver = []
var = A[n_nega-1]
if n_posi > 1:
  for i in range(n_nega,N-1):
    solver.append((var, A[i]))
    var = var - A[i]
solver.append((A[-1], var))
var = A[-1] - var
if n_nega > 1:
  for i in range(n_nega-1):
    solver.append((var, A[i]))
    var = var - A[i]

print(var)
for i in range(len(solver)):
  print(solver[i][0], solver[i][1])

 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 if N == 2:
  A.sort()
  print(A[-1] - A[0])
  print(A[-1], A[0])
  exit()

## 全部非負整数の場合 N == 2 N 2 A.sort() A.sort A sort print(A[-1] - A[0]) print A[-1] - A[0] A[-1] A -1 A[0] A 0 print(A[-1], A[0]) print A[-1] A -1 A[0] A 0 exit() exit if sum(a < 0 for a in A) == 0:
  A.sort()
  solver = []
  var = A[0]
  for i in range(1,N-1):
    solver.append((var, A[i]))
    var = var - A[i]
  else:
    solver.append((A[-1], var))
    var = A[-1] - var

  print(var)
  for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
  exit()
  
## 全部非正整数の場合 sum(a < 0 for a in A) == 0 sum(a < 0 for a in A) sum a < 0 a 0 0 A.sort() A.sort A sort solver = [] solver [] var = A[0] var A[0] A 0 for i in range(1,N-1):
    solver.append((var, A[i]))
    var = var - A[i]
  else:
    solver.append((A[-1], var))
    var = A[-1] - var

   i range(1,N-1) range 1 N-1 N 1 solver.append((var, A[i])) solver.append solver append (var, A[i]) var A[i] A i var = var - A[i] var var - A[i] var A[i] A i solver.append((A[-1], var)) solver.append solver append (A[-1], var) A[-1] A -1 var var = A[-1] - var var A[-1] - var A[-1] A -1 var print(var) print var for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
   i range(len(solver)) range len(solver) len solver print(solver[i][0], solver[i][1]) print solver[i][0] [i] solver i 0 solver[i][1] [i] solver i 1 exit() exit if sum(a > 0 for a in A) == 0:
  A.sort(reverse=True)
  solver = []
  var = A[0]
  for i in range(1,N):
    solver.append((var, A[i]))
    var = var - A[i]

  print(var)
  for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
  exit()
  
## 正整数も負整数もある場合 sum(a > 0 for a in A) == 0 sum(a > 0 for a in A) sum a > 0 a 0 0 A.sort(reverse=True) A.sort A sort reverse=True reverse True solver = [] solver [] var = A[0] var A[0] A 0 for i in range(1,N):
    solver.append((var, A[i]))
    var = var - A[i]

   i range(1,N) range 1 N solver.append((var, A[i])) solver.append solver append (var, A[i]) var A[i] A i var = var - A[i] var var - A[i] var A[i] A i print(var) print var for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
   i range(len(solver)) range len(solver) len solver print(solver[i][0], solver[i][1]) print solver[i][0] [i] solver i 0 solver[i][1] [i] solver i 1 exit() exit A.sort() A.sort A sort n_nega = sum(a < 0 for a in A) n_nega sum(a < 0 for a in A) sum a < 0 a 0 n_posi = sum(a > 0 for a in A) n_posi sum(a > 0 for a in A) sum a > 0 a 0 solver = [] solver [] var = A[n_nega-1] var A[n_nega-1] A n_nega-1 n_nega 1 if n_posi > 1:
  for i in range(n_nega,N-1):
    solver.append((var, A[i]))
    var = var - A[i] n_posi > 1 n_posi 1 for i in range(n_nega,N-1):
    solver.append((var, A[i]))
    var = var - A[i] i range(n_nega,N-1) range n_nega N-1 N 1 solver.append((var, A[i])) solver.append solver append (var, A[i]) var A[i] A i var = var - A[i] var var - A[i] var A[i] A i solver.append((A[-1], var)) solver.append solver append (A[-1], var) A[-1] A -1 var var = A[-1] - var var A[-1] - var A[-1] A -1 var if n_nega > 1:
  for i in range(n_nega-1):
    solver.append((var, A[i]))
    var = var - A[i] n_nega > 1 n_nega 1 for i in range(n_nega-1):
    solver.append((var, A[i]))
    var = var - A[i] i range(n_nega-1) range n_nega-1 n_nega 1 solver.append((var, A[i])) solver.append solver append (var, A[i]) var A[i] A i var = var - A[i] var var - A[i] var A[i] A i print(var) print var for i in range(len(solver)):
  print(solver[i][0], solver[i][1]) i range(len(solver)) range len(solver) len solver print(solver[i][0], solver[i][1]) print solver[i][0] [i] solver i 0 solver[i][1] [i] solver i 1 var = A[0] A[0] var var = A[-1] - var A[-1] - var var N = int(input()) int(input()) N n_nega = sum(a < 0 for a in A) sum(a < 0 for a in A) n_nega var = var - A[i] var - A[i] var var = var - A[i] var - A[i] var n_posi = sum(a > 0 for a in A) sum(a > 0 for a in A) n_posi var = A[-1] - var A[-1] - var var solver = [] [] solver A = list(map(int,input().split())) list(map(int,input().split())) A solver = [] [] solver var = var - A[i] var - A[i] var var = var - A[i] var - A[i] var var = A[n_nega-1] A[n_nega-1] var var = A[0] A[0] var solver = [] [] solver
N = int(input())
A = list(map(int,input().split()))

## 2個しかない場合
if N == 2:
  A.sort()
  print(A[-1] - A[0])
  print(A[-1], A[0])
  exit()

## 全部非負整数の場合
if sum(a < 0 for a in A) == 0:
  A.sort()
  solver = []
  var = A[0]
  for i in range(1,N-1):
    solver.append((var, A[i]))
    var = var - A[i]
  else:
    solver.append((A[-1], var))
    var = A[-1] - var

  print(var)
  for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
  exit()
  
## 全部非正整数の場合
if sum(a > 0 for a in A) == 0:
  A.sort(reverse=True)
  solver = []
  var = A[0]
  for i in range(1,N):
    solver.append((var, A[i]))
    var = var - A[i]

  print(var)
  for i in range(len(solver)):
    print(solver[i][0], solver[i][1])
  exit()
  
## 正整数も負整数もある場合
A.sort()
n_nega = sum(a < 0 for a in A)
n_posi = sum(a > 0 for a in A)
solver = []
var = A[n_nega-1]
if n_posi > 1:
  for i in range(n_nega,N-1):
    solver.append((var, A[i]))
    var = var - A[i]
solver.append((A[-1], var))
var = A[-1] - var
if n_nega > 1:
  for i in range(n_nega-1):
    solver.append((var, A[i]))
    var = var - A[i]

print(var)
for i in range(len(solver)):
  print(solver[i][0], solver[i][1])


