Investing money at different rates.

Okay

Sam has $12,000. He invests this money into a savings account and a bond account. The savings account has an interest rate of 4%, while the bond has a rate of 6%. The total interest he collected at the end of the year was $640. how much did he invest into each account? I've done these multiple times in class but I can't get the formula drilled into my brain.

i know that

x+y = 12000

and .04x + .06y = 640

x = savings

y = bond

so y = 12000 - x

.04x + .06(12000 - x) = 640

if i distribute i get..

.04x + 720 - .06x = 640

.04x -.06x = -.02x

-.02x + 720 = 640

this is where I got lost

this is where I got lost.