from math import gcd, lcm N = int(input()) A, B, C = map(int, input().split()) x = N//A + N//B + N//C y = N//lcm(A, B) + N//lcm(B, C) + N//lcm(C, A) z = N//lcm(A, B, C) ans = x - y + z print(ans)