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