Farmer Bob is buying cereal boxes at his local grocery store, which are priced in the following way:
- The first
cereal boxes cost dollars each - For every
boxes purchased, the price of any subsequent boxes is increased by dollars
Bob only has
Constraints
For all subtasks:
Input Specification
The only line of input contains four integers
Output Specification
Output the maximum number of cereal boxes Bob can buy.
Sample Input 1
Copy
2 1 3 35
Sample Output 1
Copy
7
Explanation for Sample 1
The prices of the cereal boxes Bob can buy are
Sample Input 2
Copy
1 15 1 10
Sample Output 2
Copy
0
Comments