Solution to the matrix chain multiplication problem on page 370~378.