A small company took out three loans totaling $25,000. The company was able to borrow some of the money at 4% interest. It borrow $2000 more than one-half the amount of the 4% loan at 6% and the rest at 5%. The total annual interest was $12220. How much did the company borrow at each rate?