import Control.Monad.State input = (read :: String -> Int) <$> getLine hoge :: State (Int, Int) Int hoge = do (workLeft, dayLeft) <- get if dayLeft /= 1 then do let w = workLeft `div` dayLeft^2 nw = workLeft - w put (nw, dayLeft-1) hoge else return workLeft main = do{ w <- input; d <- input; return (w,d)} >>= \n -> print $ fst $ runState hoge n