import math tmp = input().split(" ") N = int(tmp[0]) p = float(tmp[1]) cand = [i for i in range(3, N+1, 2)] primes = [2] while len(cand) > 0: primes.append(cand[0]) if primes[-1] * primes[-1] > N: break cand = [i for i in cand[1:] if i % primes[-1] != 0] primes = set(primes) count = 0 for i in range(2, N+1): if i in primes: count += 1.0 memo[i] = 1 else: cnt = 0 for j in range(2,i): if i % j == 0: cnt += 1 memo[i] = cnt count += (1.0-p) ** cnt print(count)