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

~/algor $ cat problems/ikki-nuqtadan-togri-chiziq

Line through two points

Medium 1000 ms 64 MB 38%
Share

Two points on the plane are given: $A(x_{1}; y_{1})$ and $B(x_{2}; y_{2})$. Find the coefficients $k$ and $b$ of the line $y = k * x + b$ passing through them:

$$k = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}, \qquad b = y_{1} - k * x_{1}$$

Points A and B on the coordinate plane and the line through them; its slope k and its y-intercept b

Input

One line with four integers: $x_{1}$, $y_{1}$, $x_{2}$ and $y_{2}$.

Output

One line with two numbers: $k$ and $b$, each with exactly 2 digits after the decimal point (for example, 2.00). If the rounded result is zero (for example, $-0.001$), print 0.00 (not -0.00).

Note

$-1000 \le x_{1}, y_{1}, x_{2}, y_{2} \le 1000$
$x_{1} \ne x_{2}$

Examples

Input #1
1 3 3 7
Output #1
2.00 1.00
Input #2
-2 1 4 -2
Output #2
-0.50 0.00

Sign in to submit a solution

Signing up is free and takes a minute.