A and B started a business with investment of Rs.90,000 and Rs.80,000 respectively. After 5 months, B left the business and C joined with a capital which is Rs.60,000 less than that of B. If at the end of the year, the share of C in the profit was Rs.42,000, then find the total profit earned at the end of the year.