First of all, we will generate all possible combinations of “”(-liter bottle) and “”(-liter bottle) by a nested loop and count the sum of liters of every combination in complexity.
Now for each from to , we will try to take number of liters bottle. That is to say, for each , we will add the count of liters generated by the combination to the answer.