P-Karte
Dimitrije loves to play with his cards. The card he fancies more than any other is the queen of spades. Once he decided to bring it to school.
The probability teacher had a sudden streak of inspiration after she spotted the queen of spades, and immediately posed one of her typical tasks to the students. The task is as follows:
We are given a natural number N (1 <= N < 2^64) and an array of P different prime numbers (1 <= P <= 6). We randomly pick a natural number smaller than N. Determine the probability of the picked number being divisible with at least one of the given primes. The primes will be lesser than 100000.
InputIn the first line of the standard input, two integers N and P are located. From the second line input the given array of primes.
OutputWrite to the standard output the probability of picking a number divisible by at least one of the given primes, rounded to 5 decimals. Solutions deviating from the test case by 0.00001 will be correct.
Input:
Output:
1000 2
5 11Output:
0.27127Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.