Note that we have used the Distributive law in the form (AC)(BC)     (AB)C.