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

~/algor $ cat problems/kesik-konus

Truncated cone

Medium 1000 ms 64 MB 36%
Share

The base radii $R$ and $r$ of a truncated cone (frustum) and its height $h$ are given. Find its slant height $l$, volume $V$ and total surface area $S$ (the total surface is the two bases plus the lateral surface):

$$l = \sqrt{h^{2} + (R - r)^{2}}, \qquad V = \frac{\pi * h * (R^{2} + R * r + r^{2})}{3}, \qquad S = \pi * (R^{2} + r^{2} + (R + r) * l)$$

Use $\pi = 3.141592653589793$.

A truncated cone: bottom base radius R, top base radius r, height h, slant height l

Input

One line with three positive integers: $R$, $r$ and $h$.

Output

One line with three numbers: $l$, $V$ and $S$, each with exactly 2 digits after the decimal point (for example, 5.00).

Note

$1 \le r \lt R \le 1000$
$1 \le h \le 1000$

Examples

Input #1
6 3 4
Output #1
5.00 263.89 282.74
Input #2
3 1 3
Output #2
3.61 40.84 76.72

Sign in to submit a solution

Signing up is free and takes a minute.