import Data.Ratio main = getLine >>= print . solve . (map read :: [String] -> [Int]) . words solve :: [Int] -> Double solve [k, n] = fromRational $ toRational $ sum [ (x * n) % ((k + 1) * n) | x <- [0 .. k] ]