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