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:
![\begin{gathered} x+y=5000 \\ 0.07x+0.08y=380 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/lcfc0hi50ef8cvt9tm49dxq2cdz8iicyn5.png)
Solving the first equation for x and substituting it in the second equation we get:
![0.07(5000-y)+0.08y=380](https://img.qammunity.org/2023/formulas/mathematics/college/w7rlrfmkagr0gqj7xwnfk42e5za2th0e8d.png)
Solving for y we get:
![\begin{gathered} 350-0.07y+0.08y=380 \\ 0.01y=30 \\ y=3000 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/tsezaay2khiou23v6xx5ix344c4d1fbtgg.png)
Substituting y=3000 in the first equation and solving for x we get:
![\begin{gathered} x+3000=5000 \\ x=2000 \end{gathered}](https://img.qammunity.org/2023/formulas/mathematics/college/ck2urp4xr64edo3nre2vkk9fpzktd2i57i.png)
Therefore, $2000 was invested in the account paying 7%, and $3000 was invested in the account paying 8%.