#include using namespace std; typedef long long ll; ll gcd(int a,int b){ if(b)return gcd(b,a%b); return a; } ll lcm(ll a,ll b){ return a/gcd(a,b)*b; } main(){ ll N,a,b,c; scanf("%lld%lld%lld%lld",&N,&a,&b,&c); printf("%lld\n",N/a + N/b + N/c - (N/lcm(a,b) + N/lcm(b,c) + N/lcm(c,a))+N/lcm(lcm(a,b),c)); }