def gcd(a,b): a,b=max(a,b),min(a,b) while a%b: a,b=b,a%b return b def lcm(a,b): return a//gcd(a,b)*b n=int(input()) a,b,c=map(int,input().split()) out=0 out+=n//a out+=n//b out+=n//c out-=n//lcm(a,b) out-=n//lcm(a,c) out-=n//lcm(b,c) out+=n//lcm(a,lcm(b,c)) print(out)