Error: local variable 'cost_sum' referenced before assignment

To restore the original notebook you can follow the instructions in this post.