def gcd(x,y):
	if y == 0:
		return x
	else:
		return gcd(y,x % y)
def lcm(x,y):
	return (x * y) / gcd(x,y)

N = int(raw_input())
a,b,c = map(int,raw_input().split())
ab = N /lcm(a,b)
ac = N /lcm(a,c)
bc = N /lcm(b,c)
abc = N / lcm(lcm(a,b),c)
aa,bb,cc = N / a,N / b,N / c
print ((aa + bb + cc) - (ab + bc + ac) + abc)