from math import ceil,floor,sqrt,gcd,factorial def lcm(a,b): return a*b // gcd(a,b) n=int(input()) a,b,c = map(int,input().split()) z = [a] if b%a: z.append(b) if c%a and c%b: z.append(c) if len(z) == 1: print(n//z[0]) elif len(z) == 2: a=z[0] b=z[1] print(n//a + n//b - n//(lcm(a,b))) else: a=z[0] b=z[1] c=z[2] print(n//a + n//b + n//c - n//(lcm(a,b)) - n//(lcm(a,c)) - n//(lcm(b,c)) + n//(lcm(lcm(a,b),c)))