Paco had w cookies. He ate x of them. Then he bought y more cookies How many cookies did Paco have left?
Paco had 40 cookies. He ate 2 of them. Then he bought 37 more cookies. 

Paco had 40 - 2 + 37 = 75 cookies left.