#include long int yakusu(int a,int b){ long int c; c = b%a; while(c!=0){ b = a; a = c; c = b%a; } return a; } int main(void){ long long int n,ans; long long int a,b,c; scanf("%lld%lld%lld%lld",&n,&a,&b,&c); ans = n/a + n/b + n/c - (n/(a*b/yakusu(a,b)) + n/(b*c/yakusu(b,c)) + n/(a*c/yakusu(a,c))) + n/(a*b*c/yakusu(yakusu(a,b),c)); printf("%lld\n",ans); return 0; }