Bellman style backward induction (student stuff)