#include using namespace std; #define itn int #define rep(i,n) for(long long i=0;i<(long long)n;i++) #define reps(i,n) for(long long i=1;i<=(long long)n;i++) #define repi(i,n) for(int i=0;i<(int)n;i++) #define loop(i,l,r) for(long long i=(long long)l;i<=(long long)r;i++) #define loopi(i,l,r) for(int i=(int)l;i<=(int)r;i++) #define drep(i,n) for(long long i=(long long)n-1;i>=0;i--) #define drepi(i,n) for(int i=(int)n-1;i>=0;i--) #define dreps(i,n) for(int i=(int)n;i>=1;i--) #define dloop(i,l,r) for(long long i=(long long)l;i>=(long long)r;i--) #define dloopi(i,l,r) for(int i=(int)l;i>=(int)r;i--) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define yn(x) cout << (x? "Yes":"No") << endl; #define cou(x) cout << x << endl; #define emp emplace_back #pragma GCC target ("avx,avx2")//四則演算 #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops")//ループ #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")//浮動小数点 const long long mod=998244353LL; const long long mods=1000000007LL; const double inf=numeric_limits::infinity(); const int kaz=1000000005; const long long yab=2500000000000000000LL; const long long aho =-yab; const long double eps=1.0e-14L; const long double pi=acosl(-1.0L); using ll=long long; using st=string; using P=pair; using tup=tuple; using vi=vector; using vin=vector; using vc=vector; using vb=vector; using vd=vector; using vs=vector; using vp=vector

; using sp=set

; using si=set; using vvi=vector>; using vvin=vector; using vvc=vector; using vvb=vector; using vvvi=vector; using vvvin=vector; const int dx[4]={0,1,0,-1}; const int dy[4]={1,0,-1,0}; const vector ex = {-1, -1, -1, 0, 0, 1, 1, 1}; const vector ey = {-1, 0, 1, -1, 1, -1, 0, 1}; templateistream&operator>>(istream&is,vector&v){for(T&in:v)is>>in;return is;} templateostream&operator<<(ostream&os,vectorv){rep(i,v.size())os< void co(bool x,T1 y,T2 z){ if(x)cout << y << endl; else cout << z << endl; } template bool chmax(T &a, T b){ if(a T ceil(T x, U y) { return (x > 0 ? (x + y - 1) / y : x / y); } template T floor(T x, U y) { return (x > 0 ? x / y : (x - y + 1) / y); } template bool chmin(T &a, T b){ if(a>b){ a=b; return true; } return false; } template void print(vector &a){ for(int i=0;i void her(vector &a){ for(auto &g:a)g--; } vector fac,finv,invs; // テーブルを作る前処理 void COMinit(int MAX,int MOD) { fac.resize(MAX); finv.resize(MAX); invs.resize(MAX); fac[0] = fac[1] = 1; finv[0] = finv[1] = 1; invs[1] = 1; for (int i = 2; i < MAX; i++){ fac[i] = fac[i - 1] * i % MOD; invs[i] = MOD - invs[MOD%i] * (MOD / i) % MOD; finv[i] = finv[i - 1] * invs[i] % MOD; } } // 二項係数計算 long long COM(int n, int k,int MOD){ if (n < k) return 0; if (n < 0 || k < 0) return 0; return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD; } ll mypow(ll x,ll y){ ll ret=1; while(y>0){ if(y&1)ret=ret*x%mod; x=x*x%mod; y>>=1; } return ret; } ll nopow(ll x,ll y){ ll ret=1; while(y>0){ if(y&1)ret*=x; x*=x; y>>=1; } return ret; } #include using namespace atcoder; using minta=modint998244353; using mintb=modint1000000007; int main(){ cin.tie(nullptr); ll n; cin >> n; int a,b,c; cin >> a >> b >> c; ll d=lcm(a,b); ll e=lcm(a,c); ll f=lcm(b,c); ll g=lcm(e,f); cout << n/a+n/b+n/c-n/d-n/e-n/f+n/g << endl; }