A and B started a business jointly. A's investment was thrice the investment of B and the period of his investment was two times the period of investment of B. If B received Rs. 4000 as profit, then their total profit is:
A started a business with Rs. 21,000 and is joined afterwards by B with Rs. 36,000. After how many months did B join if the profits at the end of the year are divided equally?