Optimal flows in networks with multiple sources and sinks, with applications to oil and gas lease investment programs