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