We are given information about how many buns and dogs are contained in each package and are asked which is the minimum number of packages needed.
By using the hint given to us, we know that we need 5 packages of buns and 4 packages of hot dogs to feed 40 people, therefore, let's use multiples of 40 to get closer to the magic number of 500, as follows:

Now, we have already fed 480 people, we need at least 20 more, but remember that we don't want to have any leftovers and we want the same number of buns and dogs, therefore, we can't feed exactly 500, we have to feed 520, which means we have to go over another multiple of 40, by buying 5 more packages of buns and 4 more packages of hot dogs.
Therefore, the correct answer is 65 packages of buns and 52 packages of hotdogs:
