Functions
Function-19
Function-20
Function-21
~/algor $ cat problems/funksiya-kasrlarni-solishtirish
Comparing fractions
Easy
1000 ms
128 MB
26%
Write a function Compare(a, b, c, d) that returns $-1$ if the fraction $a / b$ is less than the fraction $c / d$, $0$ if they are equal and $1$ if it is greater.
Example 1: Compare(1, 2, 2, 3) → -1 — $1 / 2 \lt 2 / 3$.
Example 2: Compare(2, 4, 1, 2) → 0 — $2 / 4 = 1 / 2$.
Write only the function body.
Input
One line with four numbers: an integer $a$, a positive integer $b$, an integer $c$ and a positive integer $d$ — the arguments of the function.
Output
The value returned by the function: $-1$, $0$ or $1$.
Note
$-10^{6} \le a, c \le 10^{6}$
$1 \le b, d \le 10^{6}$
Examples
Input #1
1 2 2 3
Output #1
-1
Input #2
2 4 1 2
Output #2
0