题目描述
Problem Description
There are $n$ balls, of which $k$ are orange and the rest are green. Determine the minimum number of green balls that need to be added to ensure that the proportion of orange balls is less than or equal to $\dfrac{p}{q}$.
If there are $a$ balls in total and $b$ of them are orange, the proportion of orange balls is $\dfrac{b}{a}$.
Input Format
A single line containing four integers $n, k, p, q$.
Output Format
A single line containing one integer, representing the answer.
Sample Input and Output
Sample Input #1
3 3 5 6
Sample Output #1
1
Sample Input #2
3 2 5 6
Sample Output #2
0
Notes/Hints
Data Range and Constraints
For $30\%$ of the test cases, $q = 1$.
For another $30\%$ of the test cases, $k = 0$.
For $100\%$ of the test cases, $1 \leq n, q \leq 1000$, $0 \leq k \leq 1000$, $0 \leq p \leq q$.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分
样例输入
3 3 5 6
样例输出
1