from math import lcm 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)