In a mixture of three varieties of pulses, the ratio of their weights is 4 : 5 : 8. If 5 kg pulses of first variety, 10 kg pulses of second variety and some quantity of pulses of the third variety are added to the mixture, the ratio of the weights of three varieties of pulses become 5 : 7 : 9. Find the quantity of the third variety of pulses in final mixture.

A. 55
B. 40
C. 45
D. 52