main::IO() main= do n<-fmap read getLine m<-fmap read getLine print $ (n `div` 1000 `div` m)*1000