import java.util.Scanner; public class N316 { static long n,a,b,c; public static void main(String[] args) { Scanner sc = new Scanner(System.in); n=sc.nextInt();a=sc.nextInt();b=sc.nextInt();c=sc.nextInt(); long ab=koubai(a,b,a,b); long bc=koubai(b,c,b,c); long ca=koubai(c,a,c,a); long abc=koubai(ab,bc,ab,bc); System.out.println(n/a+n/b+n/c-n/ab-n/bc-n/ca+n/abc); } static long koubai(long a,long b,long aa,long bb){ return a*b/gcd(a,b); } static long gcd(long a,long b){ if(a%b==0){ return b; }else{ return gcd(b,a%b); } } }