AC matrix chain multiplicaton