Implemented Matrix Multiplication Chain Optimization