import fractions lcm = lambda a, b: a * b // fractions.gcd(a, b) N = int(input()) A, B, C = map(int, input().split()) lcm_ab = lcm(A, B) ans = N // A + N // B + N // C + N // lcm(lcm_ab, C) - N // lcm_ab - N // lcm( B, C) - N // lcm(C, A) print(ans)