At least once

An event has probability p on each try, independently. What is the probability that it happens at least once in n tries?

Input

One line: p (a decimal from 0 to 1) and n (a whole number, 1 to 1000).

Output

The probability to 4 decimal places.

Examples

Example 1 · Input
0.1666667 4
Expected output
0.5177
Example 2 · Input
0.5 3
Expected output
0.8750

Prompts inside input() are ignored when checking, so input("n: ") is fine.

Hints

Hint 1

'At least once' is the complement of 'never'.

Hint 2

P(never) = (1 − p) ** n when the tries are independent.

Solution

Show one correct solution (try it yourself first)
p, n = input().split()
p, n = float(p), int(n)
print(f"{1 - (1 - p) ** n:.4f}")

Lesson: Rules: not, or, and →