# -*- coding: utf-8 -*- """ No.316 もっと刺激的なFizzBuzzをください https://yukicoder.me/problems/no/316 """ import sys from sys import stdin from math import gcd input = stdin.readline def solve(N, numbers): ans = 0 a, b, c, = numbers[0], numbers[1], numbers[2] ans += N // a ans += N // b ans += N // c ab = (a * b // gcd(a, b)) bc = (b * c // gcd(b, c)) ca = (c * a // gcd(c, a)) ans -= N // ab ans -= N // bc ans -= N // ca ans += N // (ab * bc / gcd(ab, bc)) ans += N // (bc * ca / gcd(bc, ca)) ans -= N // (ab * ca / gcd(ab, ca)) return int(ans) def main(args): N = int(input()) numbers = [int(x) for x in input().split()] ans = solve(N, numbers) print(ans) if __name__ == '__main__': main(sys.argv[1:])