CF1182F Maximum Sine

Description

You have given integers $ a $ , $ b $ , $ p $ , and $ q $ . Let $ f(x) = \text{abs}(\text{sin}(\frac{p}{q} \pi x)) $ . Find minimum possible integer $ x $ that maximizes $ f(x) $ where $ a \le x \le b $ .

Input Format

N/A

Output Format

N/A

Explanation/Hint

In the first test case, $ f(0) = 0 $ , $ f(1) = f(2) \approx 0.866 $ , $ f(3) = 0 $ . In the second test case, $ f(55) \approx 0.999969 $ , which is the largest among all possible values.