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