David bought a bag of caramel chocolates and chocolate truffles in the ratio of 4 : 6. If the bag holds 24 caramel chocolates, how many chocolates in all did the bag contain?