from functools import reduce import math def my_lcm_base(x, y): return (x * y) // math.gcd(x, y) def my_lcm(*numbers): return reduce(my_lcm_base, numbers, 1) n=int(input()) a,b,c=map(int,input().split()) x=my_lcm_base(a,b) y=my_lcm_base(b,c) z=my_lcm_base(a,c) l=[a,b,c] p=my_lcm(*l) print(n//a+n//b+n//c-n//x-n//y-n//z+n//p)