import java.util.Scanner; public class Main { static long gcd(long a, long b) { if(b == 0) return a; return gcd(b, a%b); } static long lcm(long a, long b) { long g = gcd(a, b); return a / g * b; } public static void main(String[] args) { Scanner sc = new Scanner(System.in); long n = Long.parseLong(sc.next()); long a = Long.parseLong(sc.next()); long b = Long.parseLong(sc.next()); long c = Long.parseLong(sc.next()); long d = lcm(a, b); long e = lcm(b, c); long f = lcm(c, a); long g = lcm(d, c); System.out.println(n/a + n/b + n/c + n/g - n/d - n/e - n/f); } }