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:
[tex]\begin{gathered} x+y=5000 \\ 0.07x+0.08y=380 \end{gathered}[/tex]Solving the first equation for x and substituting it in the second equation we get:
[tex]0.07(5000-y)+0.08y=380[/tex]Solving for y we get:
[tex]\begin{gathered} 350-0.07y+0.08y=380 \\ 0.01y=30 \\ y=3000 \end{gathered}[/tex]Substituting y=3000 in the first equation and solving for x we get:
[tex]\begin{gathered} x+3000=5000 \\ x=2000 \end{gathered}[/tex]Therefore, $2000 was invested in the account paying 7%, and $3000 was invested in the account paying 8%.