For example you have the matrices $A, (5 \times 8), B, (8 \times 4), C (4 \times 10). $ The question wants you to find the number of multiplications if you were to multiply these matrices like $(A\times B)\times C$.
The answer is $5 \times 4 \times 8 + 5 \times 10 \times 4 = 160 + 200 = 360$ multiplications.
Let's start this step-by-step. How many multiplications do you need if you were to multiply $M (1\times 8)$ by $N (8 \times 2)$?
$M$ has one row of $8$ numbers. When we multiply that by the first column, that's $8$ multiplications, which are then added up. (It's very similar to a dot product). Then, when we multiply the second column, that's another $8$ multiplications. That's a total of $16$ numerical multiplications.
What about if we use your $A, (5 \times 8), B, (8 \times 4)$ and multiply $A\times B$? For the first row, we do $4 \times 8 = 32$ multiplications. And we do that for all $5$ rows, so the total number of multiplications is $5\times 4 \times 8 = 160$.
How about $D (5 \times 4), C (4 \times 10)$ and multiply $D \times C$? The same reasoning leads us to $5\times 4 \times 10 = 200$ multiplications.
In fact, if we let $D = A\times B$, and we added the number of multiplications, we would get $(A \times B) \times C$ takes $360$ numerical multiplications to compute.