import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.PrintWriter; import java.util.Scanner; /** * Built using CHelper plug-in * Actual solution is at the top * * @author silviase */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; Scanner in = new Scanner(inputStream); PrintWriter out = new PrintWriter(outputStream); MoreFizzBuzz solver = new MoreFizzBuzz(); solver.solve(1, in, out); out.close(); } static class MoreFizzBuzz { public void solve(int testNumber, Scanner in, PrintWriter out) { // 包徐原理を用いればいい // -a-b-c+(ab)+(bc)+(ca)-(abc) long n = in.nextLong(); long a = in.nextLong(); long b = in.nextLong(); long c = in.nextLong(); long res = +(n / a) + (n / b) + (n / c) - (n / Arith.lcm(a, b)) - (n / Arith.lcm(b, c)) - (n / Arith.lcm(c, a)) + (n / Arith.lcm(Arith.lcm(a, b), c)); out.println(res); } } static class Arith { public static long gcd(long a, long b) { return a % b == 0 ? b : gcd(b, a % b); } public static long lcm(long a, long b) { return a / gcd(a, b) * b; } } }