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