import java.util.Scanner; public class Main { public static void main(String[] p) { Scanner q = new Scanner(System.in); long n = q.nextLong(); int a = q.nextInt(); int b = q.nextInt(); int c = q.nextInt(); long ab = lcm(a, b); long bc = lcm(b, c); long ca = lcm(c, a); long abc = lcm(ab, c); System.out.println((n / a + n / b + n / c) - (n / ab + n / bc + n / ca) + n / abc); } private static long lcm(long a, long b) { long min = Math.min(a, b); long last = 0; for (long r = Math.max(a, b); r != 0;) { last = r; r = Math.abs(min - r); min = Math.min(min, last); } return a * b / last; } }