from fractions import gcd def l(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//l(l(a,b),c)-n//l(a,b)-n//l(a,c)-n//l(c,b))