s,a,b,c;g(a,b){return b?g(b,a%b):a;}main(n){scanf("%d%d%d%d",&n,&a,&b,&c);s=a*b/g(a,b);s=!printf("%d",n/a+n/b+n/c-n/s-n/(b*c/g(b,c))-n/(c*a/g(c,a))+n/(c/g(s,c))/s);}