The Optimal Depletion and Exploration of a Nonrenewable Resource