#from fractions import gcd from math import gcd # def lcm(a, b): # return a * b // gcd(a, b) lcm = lambda a, b: a * b // gcd(a, b) N = int(input()) A, B, C = map(int, input().split()) l_ab = lcm(A, B) ans = N//A + N//B + N//C + N//lcm(l_ab,C) - N//l_ab - N//lcm(B,C) - N//lcm(C,A) print(ans)