import math def lcm(x, y): return (x * y) // math.gcd(x, y) N = int(input()) A, B, C = map(int, input().split()) AB = lcm(A,B) BC = lcm(B,C) CA = lcm(C,A) ABC = lcm(AB,BC) print(N//A+N//B+N//C-N//AB-N//BC-N//CA+N//ABC)