Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/funksiya-kasrlarni-solishtirish

Comparing fractions

Easy 1000 ms 128 MB 26%
Share

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.

Two fractions go into the function Compare, which tells whether the first is smaller, equal or greater

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

Sign in to submit a solution

Signing up is free and takes a minute.