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

~/algor $ cat problems/for-ichma-ich-ildizlar

Nested roots

Medium 1000 ms 64 MB 45%
Share

An integer $a$ and a positive integer $N$ are given. Compute the value of the expression in which $N$ root signs are nested inside each other:

$$R = \underbrace{\sqrt{a + \sqrt{a + \dots + \sqrt{a}}}}_{N \text{ roots}}$$

For $N = 1$, $R = \sqrt{a}$; for $N = 2$, $R = \sqrt{a + \sqrt{a}}$.

An expression of nested roots

Input

One line with two integers: $a$ and $N$.

Output

One number — $R$, with exactly 6 digits after the decimal point (for example, 1.961571).

Note

$0 \le a \le 100$
$1 \le N \le 50$

Examples

Input #1
2 3
Output #1
1.961571
Input #2
6 2
Output #2
2.906801

Sign in to submit a solution

Signing up is free and takes a minute.