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