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(); int ab = lcm(a, b); int bc = lcm(b, c); int ca = lcm(c, a); int abc = lcm(ab, c); System.out.println((n / a + n / b + n / c) - (n / ab + n / bc + n / ca - n / abc)); } private static int lcm(int a, int b) { int min = Math.min(a, b); int last = 0; for (int r = Math.max(a, b); r != 0;) { last = r; r = Math.abs(min - r); min = Math.min(min, last); } return a * b / last; } }