A and B enter into a partnership with Rs. 50,000 and Rs. 60,000 respectively. C joins them after x months contributing Rs 70,000 and B leaves x months before the end of the year. If they share the profit in the ratio of 20: 18: 21, then find the value of x.