~/algor $ cat problems/geometrik-progressiya-yigindisi
Geometric progression sum
Easy
1000 ms
64 MB
28%
A real number $a$ and a positive integer $N$ are given. Compute the sum:
$$S = 1 + a + a^{2} + a^{3} + \dots + a^{N}$$
Input
One line with a real number $a$ and a positive integer $N$.
Output
One number — $S$, with exactly 2 digits after the decimal point (for example, 15.00).
Note
$0 \lt a \le 10$
$a$ has at most $1$ digit after the decimal point
$1 \le N \le 10$
Examples
Input #1
2 3
Output #1
15.00
Input #2
3 2
Output #2
13.00