main = getContents >>= print . solve . map read . lines where solve [w, d] = foldr (\x acc -> acc - div acc (x ^ 2)) w [2..d]