n = int(input()) a, b, c = [ int(v) for v in input().split(" ") ] def gcm(a,b): if a > b: a, b = b, a while a != 0: a, b = b % a, a return b def lgm(a,b): return a*b//gcm(a,b) def lgm3(a,b,c): return lgm(lgm(a,b),c) nlist = [ n//a, n//b, n//c, -(n//(lgm(a,b))), -(n//(lgm(b,c))), -(n//(lgm(c,a))), n//(lgm3(a,b,c)) ] print(sum(nlist))