import java.util.Scanner; public class Main{ public static void main(String... args){ Scanner scan = new Scanner(System.in); long n = scan.nextLong(); int a = scan.nextInt(); int b = scan.nextInt(); int c = scan.nextInt(); System.out.println(n/a+n/b+n/c - (n/lcm(a,b)+n/lcm(b,c)+n/lcm(c,a)) + n/lcm(a,lcm(b,c))); } public static long gcd(long a,long b){ if(b == 0){ return a; } return gcd(b,a%b); } public static long lcm(long a,long b){ return a*b/gcd(a,b); } }