let x = weight (in decimal form) of total invested at 7%, thus (1 - x) = weight of total invested at 6%
0.07x + 0.06(1 - x) = 0.0664
0.07x + 0.06 - 0.06x = 0.0664
0.01x = 0.0664 - 0.06
0.01x = 0.0064
x = 0.0064 / 0.01
x = 0.64, thus 64% of the total is invested at 7% = 5,000 x 0.64 = $3,200
and: (1 - x) = 0.36, or 36% is invested at 6% = 5,000 x 0.36 = $1,800
(or, more simply, 5,000 - 3,200 = 1,800 invested at 6%)
check math:
3200 x 0.07 = 224
1800 x 0.06 = 108
Total: $332