The simple interest formula is:

where P is the prinipal, r is the interest rate (in decimal form) and t is the time.
Since Louie invested 5000 for three years at a rate of 2.5% he has:

$375 of intetest after 3 years, that is he has a total of $5375. Then he removes $1000, and invest the rest for 4 years at a rate of 4%, then he has:

Therefore she has in total $5075 at the end.