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

~/algor $ cat problems/begin-ichki-va-tashqi-aylana

Inscribed and circumscribed circles

Medium 1000 ms 64 MB 37%
Share

The sides of a triangle $a$, $b$ and $c$ are given. Find the radius $r$ of its inscribed circle and the radius $R$ of its circumscribed circle; $p$ is the semi-perimeter, $S$ is the area:

$$p = \frac{a + b + c}{2}, \qquad S = \sqrt{p * (p - a) * (p - b) * (p - c)}, \qquad r = \frac{S}{p}, \qquad R = \frac{a * b * c}{4 * S}$$

A triangle (sides a, b, c), its inscribed circle (radius r) and its circumscribed circle (radius R)

Input

One line with three positive integers: $a$, $b$ and $c$.

Output

One line with two numbers: $r$ and $R$, each with exactly 3 digits after the decimal point (for example, 1.000).

Note

$1 \le a, b, c \le 1000$
Such a triangle exists: the sum of any two sides is greater than the third.

Examples

Input #1
3 4 5
Output #1
1.000 2.500
Input #2
2 2 2
Output #2
0.577 1.155

Sign in to submit a solution

Signing up is free and takes a minute.