Madara, as you know, is not generally a person to work-out. But recently his girlfriend told him to get in shape. So he started going to the gym everyday.
He knows that he must do at least N number of push-ups in a day. If he is unable to do N push-ups altogether, he does them in different sets. He knows he can do at max A push-ups in the same set. Every time he does a set, he becomes a little tired and hence does D number of push-ups less in the next set. But no matter how tired he gets, he is capable of doing M number of push-ups at the least.
What is the minimum number of sets in which Madara can complete his daily goal?
INPUT:
The first line contains an Integer T, the number of test cases. Each test case consists of four integers - N, A, D and M.
OUTPUT:
For each test case, output an single Integer denoting the minimum number of sets on a new line.
CONSTRAINTS:
1 <= T <= 100
1 <= A, N <=1000
1 <= D <= 500
5 <= M <= 100
In the first test case, in the first set he can do 20 push-ups, in the second set, he can do 19, in the third set he will do 18. Thus doing a total of 57 push-ups in 3 sets, which fulfills his daily requirement of at least 50 push-ups.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor