Three friends, A, B, C collecting Rs. 8000, Rs. 10000 and Rs. 12000 respectively and taking a loan from the bank, started a business. At the end of the year, their profit is Rs. 13400. From that profit, they repaid the bank instalment of Rs. 5000 and then the rest of the profit was distributed amongst themselves according to the ratio of their capitals. Find the amount of profit of each of them.