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; if(a == b) { ans = a; } else if(a > b) { ans = gcd(b, a-b); } else if(a < b) { ans = gcd(a, b-a); } return ans; } }