import Control.Applicative ((<$>)) countFactors :: Int -> Int countFactors n = length [f | f <- [1 .. n], mod n f == 0] prob :: Double -> Int -> Double prob p n = (1 - p) ** (fromIntegral $ countFactors n - 2) main :: IO () main = do (n : p : _) <- words <$> getLine print $ sum $ map (prob $ read p) [2 .. read n]