Measurement of CP observables in B± → DK± and B± → Dπ± with two- and four-body D decays