Paco had 40 cookies. He ate 5 cookies and gave 13 of them to his friend. How many cookies did paco have left?