import fractions from functools import reduce def lcm(*n): return reduce(lambda a, b: a * b // fractions.gcd(a, b), n) N = int(input()) A, B, C = map(int, input().split()) ans = N // A + N // B + N // C ans -= N // lcm(A, B) + N // lcm(B, C) + N // lcm(C, A) ans += N // lcm(A, B, C) print(ans)