When calculating A×B, the number of columns of A = number of rows of B.
Thus, only last case is possible.