At a bag sale, the total amount of money collected from the sales was $12 150. The number of Bag P and Bag Q sold were in the ratio of 5 : 2. The number of Bag Q and Bag R sold were in the ratio of 3 : 4. The cost of Bag P was $50. The ratio of the cost of Bag P to the cost of Bag Q to the cost of Bag R was 1 : 3 : 6. What was the total number of bags sold at the sale?