import Data.List
import Control.Monad

func::Int->Int->Int->[Int]
func a c d = if a `mod` c == 0 || a `mod` d == 0 then [] else [a]
 
main::IO ()
main = do
    [a,b,c,d] <- map read . words <$> getLine
    print $ length $ concat $ map (\x-> func x c d) [a..b]