Justin invested his savings in two investment funds. The $8000 he invested in Fund A returned a 10% profit. The amount he invested in Fund B returned a 3% profit. How much did he invest in Fund B, if both funds together returned a 7% profit?