import java.io.*; import java.util.*; class Main { public static void out (Object o) { System.out.println(o); } public static long gcd (long a , long b) { if (a < b) { long tmp = a; a = b; b = tmp; } if (b == 0) return a; return gcd(b , a % b); } public static long solve (int n , int a , int b , int c) { long d = a * b / gcd(a , b); long e = b * c / gcd(b , c); long f = c * a / gcd(c , a); long g = c * d / gcd(c , d); return n / a + n / b + n / c - (n / d + n / e + n / f) + n / g; } public static void main (String[] args) throws IOException { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int a = sc.nextInt(); int b = sc.nextInt(); int c = sc.nextInt(); out(solve(n,a,b,c)); } }