#!/usr/bin/env python3 # from typing import * import sys import io import math import collections import decimal import itertools import bisect import heapq def input(): return sys.stdin.readline()[:-1] # sys.setrecursionlimit(1000000) # _INPUT = """100 # 2 3 5 # """ # sys.stdin = io.StringIO(_INPUT) def lcm(n1, n2): return n1 * n2 // math.gcd(n1, n2) N = int(input()) a, b, c = map(int, input().split()) ans = N//a + N//b + N//c - N//lcm(a,b) - N//lcm(b,c) - N//lcm(a,c) + N//lcm(a,lcm(b,c)) print(ans)