def lcm(a, b): from fractions import gcd return (a * b) // gcd(a, b) n=int(input()) a,b,c=map(int,input().split()) ans=n//a+n//b+n//c+n//lcm(lcm(a,b),c)-n//lcm(a,b)-n//lcm(a,c)-n//lcm(c,b) print(ans)