n,a,b,c=$<.read.split.map &:to_i;d=a.lcm b;p n/a+n/b+n/c-n/d-n/b.lcm(c)-n/c.lcm(a)+n/d.lcm(c)