Use the backward induction to solve