find minimum cost of multiplication of the chain of matrices