Hello, I understand why when two matrices X and Y with dimensions a by b and b by c are mutliplied, the runtime is of O(abc). But I cannot understand the runtime is calculation when multiplying A D A^\top C where:

A \in \mathbb{R}^{m \times n}

D \in \mathbb{R}^{n \times n} and D is a diagonal matrix with nonnegative entries

C \in \mathbb{R}^{m \times k}

The answer given is O(2mnk + n^2k). How do you derive it?

(This is part of homework 1, 1.2 Semidefinite matrices)