Help - Johnny and the Beanstalk

I’m receiving WA on this problem. My code only fails in the first test case. Is the code missing something? Help.