Combinatorics: Getting all of the chocolates in a square at minimum cost Consider a $101$ by $101$ square array. Each unit square is surrounded by a fence. However, if two squares share a common edge, there is a doorway between the fence along their common edge. It costs $\$1$ each time a person wants to pass through a doorway.

In each of $5101$ of the unit squares, one chocolate is placed. Jake wants to collect all the chocolates. He is permitted to select any square in the array to begin his journey and may only change squares by passing through a doorway. What is the minimum amount of cash Jake should carry with him in order to be guaranteed, that if he is smart enough, he will collect all of the chocolates.

I've tried to do a worst possible case type argument, but it's hard to work out a worst possible case given the added complexity of Jake being able to choose his starting location.

Is the fact that $101$ prime, relevant? Could we try small primes with $\frac{p+1}{2}$ chocolates and do some sort of induction?
Color the squares like a checkerboard.  If the corners are white, there are $5101$ white squares.  The worst case is that the chocolates are in all the white squares.  Jake will have to go through all the squares to get all the chocolate and will need $\$10200$ to do that.

This applies if every pass through a door costs.  If you can leave a door open and go back through it free, you can do better.  I think you can miss almost half the black squares then.
The greedy chocolate eater will have to go from one square to the next, so they can't do better than 5100 doors. Just starting on one corner and going down along the border, then the next line up, and so clearly doesn't do "too many" doors.