AT_abc408_g [ABC408G] A/B < p/q < C/D
Description
You are given positive integers $ A,B,C,D $ satisfying $ \displaystyle \frac AB < \frac CD $ .
Find the smallest positive integer $ q $ satisfying the following condition:
- There exists a positive integer $ p $ such that $ \displaystyle \frac AB
Input Format
The input is given from Standard Input in the following format:
> $ T $ $ \text{case}_1 $ $ \text{case}_2 $ $ \vdots $ $ \text{case}_T $
Here, $ \text{case}_i $ represents the $ i $ -th test case.
Each test case is given in the following format:
> $ A $ $ B $ $ C $ $ D $
Output Format
Output $ T $ lines. The $ i $ -th line should contain the answer for the $ i $ -th test case.
Explanation/Hint
### Sample Explanation 1
Consider the first test case.
For example, if $ p=5,q=3 $ , then $ \displaystyle \frac32