import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); long N = sc.nextInt(); long a = sc.nextInt(); long b = sc.nextInt(); long c = sc.nextInt(); long ablcm = a*b/gcd(a,b); long bclcm = b*c/gcd(b,c); long calcm = c*a/gcd(c,a); long ALLlcm = ablcm*c/gcd(ablcm,c); long num=N/a+N/b+N/c-N/ablcm-N/bclcm-N/calcm+N/ALLlcm; System.out.println(num); } static long gcd(long x, long y){ while(true){ long t=x%y; x=y; y=t; if(t==0){break;} } return x; } }