N,P=map(float,input().split()) M=int(N)+1 l=[1.0]*M for i in range(2,M): for j in range(i+i,M,i):l[j]*=1-P print(sum(l[2:]))