def gcd(m, n, r=1):
    if m<n: m,n=n,m
    while n: m,n = n,m%n
    return m
def lcm(m, n):
    return m*n/gcd(m, n)
n = input()
a, b, c = map(int, raw_input().split())
print n/a+n/b+n/c-n/lcm(a,b)-n/lcm(b,c)-n/lcm(c,a)+n/lcm(lcm(a,b),c)