def lcm(a, b): return a * b // gcd(max(a, b), min(a, b)) def gcd(a, b): if b > 0: return gcd(b, a % b) return a def main(): n = int(input()) a, b, c = map(int, input().split()) lab, lbc, lca = lcm(a, b), lcm(b, c), lcm(c, a) labc = lcm(lab, c) num = (n//a+n//b+n//c) - (n//lab+n//lbc+n//lca) + n // labc print(num) if __name__ == "__main__": main()