local n, p = io.read("*n", "*n") local function getyakusuu(x) local tmp = {} local lim = math.ceil(math.sqrt(x)) local dv = 2 while(1 < x and dv <= lim) do if(x % dv == 0) then tmp[dv] = 1 x = x / dv while(x % dv == 0) do x = x / dv tmp[dv] = tmp[dv] + 1 end end if(dv == 2) then dv = 3 elseif(dv == 3) then dv = 5 elseif(dv == 5) then dv = 7 else local dv15 = dv % 15 if(dv15 == 4 or dv15 == 7 or dv15 == 13) then dv = dv + 4 elseif(dv15 == 1 or dv15 == 8) then dv = dv + 6 else dv = dv + 2 --2, 11, 14 end end end if(x ~= 1) then tmp[x] = 1 end local cnt = 1 for k, v in pairs(tmp) do cnt = cnt * (v + 1) end return cnt end local tot = 0 for i = 2, n do local z = getyakusuu(i) - 2 if(z == 0) then tot = tot + 1 else tot = tot + (1 - p)^z end end print(string.format("%.8f", tot))