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

~/algor $ cat problems/begin-uchburchak-perimetri

Perimeter of a triangle

Medium 1000 ms 64 MB 34%
Share

The vertices of a triangle on the plane are given: $A(x_{A}; y_{A})$, $B(x_{B}; y_{B})$ and $C(x_{C}; y_{C})$. Find its perimeter $P$; each side is the distance between two points:

$$P = AB + BC + CA, \qquad AB = \sqrt{(x_{B} - x_{A})^{2} + (y_{B} - y_{A})^{2}}$$

A triangle with vertices A, B and C on the coordinate plane

Input

One line with six integers: $x_{A}$, $y_{A}$, $x_{B}$, $y_{B}$, $x_{C}$ and $y_{C}$.

Output

One number — $P$, with exactly 3 digits after the decimal point (for example, 12.000).

Note

$-1000 \le x_{A}, y_{A}, x_{B}, y_{B}, x_{C}, y_{C} \le 1000$
The three points do not lie on one line.

Examples

Input #1
0 0 3 0 0 4
Output #1
12.000
Input #2
0 0 1 0 0 1
Output #2
3.414

Sign in to submit a solution

Signing up is free and takes a minute.