add matrix chain multiplication