def main(): import sys N, p = sys.stdin.readline().split() N = int(N) p = float(p) # Initialize div_count to count the number of divisors d where 1 < d < k for each k div_count = [0] * (N + 1) for d in range(2, N): multiple = 2 * d while multiple <= N: div_count[multiple] += 1 multiple += d # Calculate the sum of expected values expected = 0.0 for k in range(2, N + 1): if div_count[k] == 0: # It's a prime expected += 1.0 else: # Composite, multiply (1 - p) for each divisor expected += (1.0 - p) ** div_count[k] # Print with enough precision print("{0:.10f}".format(expected)) if __name__ == "__main__": main()