import fractions N = int(input()) a, b, c = map(int, input().split()) def lcm(a, b): return a * b // fractions.gcd(a, b) count = N//a + N//b + N //c count = count - (N//lcm(a, b)) - (N//lcm(b, c)) - (N//lcm(a, c)) + (N//lcm(lcm(a,b),c)) print(count)