n=gets.to_i;a,b,c=gets.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)