Let x be the amount invested in the account paying 7% and y the amount invested in the account paying 8%, then we can set the following system of equations:

Solving the first equation for x and substituting it in the second equation we get:

Solving for y we get:

Substituting y=3000 in the first equation and solving for x we get:

Therefore, $2000 was invested in the account paying 7%, and $3000 was invested in the account paying 8%.