Example
Suppose A1 is 10x100, A2 is 100x5, and A3 is 5x50.
Then A1 (A2 A3) 100*5*50 + 10*100*50 = 25,000 + 50,000 = 75,000 scalar multiplications (A2 A3 is a 100x50 matrix).
(A1 A2) A3 10*100*5 + 10*5*50 = 5,000 + 2,500 = 7,500 scalar multiplications (A1 A2 is a 10x5 matrix).