f = \x y->div x y main=do n<-getLine>>=return.(read::String->Integer) [a,b,c]<-getLine>>=return.map(read::String->Integer).words print$f n a + f n b + f n c - f n (lcm a b) - f n (lcm b c) - f n (lcm a c) + f n (lcm (lcm a b) c)