n,a,b,c=STDIN.read.split.map(&:to_i)
ab=a*b/a.gcd(b)
ac=a*c/a.gcd(c)
bc=b*c/b.gcd(c)
abc=ab*c/ab.gcd(c)
p n/a+n/b+n/c-n/ab-n/ac-n/bc+n/abc