##### Debt of Lannister

Lannister’s Debt

Tyrion Lannister wants to pay Bronn reward for his services. Being a Lannister, he has an unlimited number of coins of denominations A, and B. He has also got an unlimited number of bags, in which he can give the money. Each bag can contain at most

N rupees. Tyrion wants to pay Bronn at least M rupees.

As you know, Tyrion cannot lift many bags, so he wants to minimise the number of bags. Also, all the bags should contain the same amount.

Can you help Tyrion in finding the minimum number of bags required?

First line contains T the number of test-cases. The only line of each test case contains four integers –

M,N,A,B.

OUTPUT

For each test case, print the minimum number of bags required in one line.

CONSTRAINTS

1≤T≤10

1≤M≤10^18

1≤A,B≤N≤10^6

```
import math
for i in range(int(input())):
s = [int(x) for x in input().split()]
y = max([s[2],s[3]])
z = min([s[2],s[3]])
if (s[1]%y == 0 or s[1]%z ==0):
f=0
else:
r = s[1]%y
f = s[1]%z
while(r<s[1]):
x = r%z
if x<f:
f = x
if x == 0:
break
else:
r = r + y
s[1] = s[1] - f
print(math.ceil(s[0]/s[1]))
```