import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from fractions import gcd from functools import reduce N,a,b,c = map(int,read().split()) def f(*args): lcm = reduce(lambda x,y: x*y//gcd(x,y), args, 1) return N//lcm answer = f(a) + f(b) + f(c) - f(a,b) - f(a,c) - f(b,c) + f(a,b,c) print(answer)