Interest/loan question

Hi all

Just wondering if someone could help me out this...

I have two loans of differing amounts and interest rates.

I have x amount of dollars that I want to pay on each loan to achieve the lowest possible interest payable.

How can I work it out?

CRGreathouse
$$P\left( \frac{ni/12}{1-(1+i/12)^{-n}}-1\right)$$