added optimal parenthesization of matrix chain multiplication