import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); if(a==1 || b==1 || c==1) { System.out.println(N); } else { 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); long ans = N / a + N / b + N / c - (N / d + N / e + N / f) + N / g; System.out.println(ans); } } static long gcd(long a, long b) { long ans = 0; while(true) { if(a == b) { ans = a; break; } else if(a > b) { long tmp = a-b; a = b; b = tmp; } else if( a < b) { long tmp = b-a; a = a; b = tmp; } } return ans; } }