need help on setting up a formula

Most of Conservative Casey's money was put into a savings account that

paid 5% interest a year, but some of it was put into a risky stock fund that paid 16% a year. Casey's total initial investment in the two acounts was $10000. At the end of the first year, Casey recieved a total of $775 in interest from the two accounts. Find the amount invested in each.

I did guess and check. Started out with 8000 and 2000 got 720 in interest. then I tried 7500 and 2500 and got the answer 775.

Getting tired of guessing all the time. I wish I was better at algebra.(Crying)

How can I solve this with algebra?

Vicky.