import math from functools import reduce def lcm(x,y): return (x*y)//math.gcd(x,y) def lcms(*nums): return reduce(lcm,nums,1) n=int(input()) a,b,c=map(int,input().split()) print(n//a+n//b+n//c-n//lcm(a,b)-n//lcm(b,c)-n//lcm(c,a)+n//lcms(a,b,c))