Codeforces Round #723 (Div. 2) C1. Potions

Problem:

My solution:

I want to know what’s wrong with my code…I am getting WA on the 4th test case.
Thank you in advance