from math import gcd def lcm(a, b): return a // gcd(a, b) * b N = int(input()) a, b, c = map(int, input().split()) l1 = lcm(a, b) l2 = lcm(b, c) l3 = lcm(c, a) l4 = lcm(l1, c) print(N // a + N // b + N // c - N // l1 - N // l2 - N // l3 + N // l4)