A, B and C invest Rs.150000 Rs. 250000 and Rs. 350000 respectively into a partnership firm. A is given Rs. 1000 per month as salary, B is given 10% commission of profit after deducting the salary given to A and the remaining profit is shared among them. At the end of the year if B received a total of Rs. 30000 as his share, find the total profit earned.